Author: marek Date: 2010-07-01 22:29:52 +0200 (Thu, 01 Jul 2010) New Revision: 1731
Modified: trunk/batman-adv/originator.c Log: batman-adv: Add last-seen in originator table
Right now, there is no easy/intuitive way to find out whether a node might have vanished. This commit adds the time when a node was last seen to the originator table output, so that a common user is able to tell whether a node might have gone without having to wait PURGE_TIMEOUT seconds until that node gets "garbe-collected". It also puts the the versioning information in an extra line, as the first one of this debug output would otherwise get too long.
Signed-off-by: Linus L?\195?\188ssing linus.luessing@web.de
Modified: trunk/batman-adv/originator.c =================================================================== --- trunk/batman-adv/originator.c 2010-07-01 20:29:50 UTC (rev 1730) +++ trunk/batman-adv/originator.c 2010-07-01 20:29:52 UTC (rev 1731) @@ -296,6 +296,8 @@ struct orig_node *orig_node; struct neigh_node *neigh_node; int batman_count = 0; + int last_seen_secs; + int last_seen_msecs; unsigned long flags; char orig_str[ETH_STR_LEN], router_str[ETH_STR_LEN];
@@ -312,12 +314,13 @@ }
rcu_read_lock(); - seq_printf(seq, " %-14s (%s/%i) %17s [%10s]: %20s " - "... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n", - "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", - "Potential nexthops", SOURCE_VERSION, REVISION_VERSION_STR, + seq_printf(seq, "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n", + SOURCE_VERSION, REVISION_VERSION_STR, bat_priv->primary_if->dev, bat_priv->primary_if->addr_str, net_dev->name); + seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", + "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop", + "outgoingIF", "Potential nexthops"); rcu_read_unlock();
spin_lock_irqsave(&orig_hash_lock, flags); @@ -334,9 +337,14 @@
addr_to_string(orig_str, orig_node->orig); addr_to_string(router_str, orig_node->router->addr); + last_seen_secs = jiffies_to_msecs(jiffies - + orig_node->last_valid) / 1000; + last_seen_msecs = jiffies_to_msecs(jiffies - + orig_node->last_valid) % 1000;
- seq_printf(seq, "%-17s (%3i) %17s [%10s]:", - orig_str, orig_node->router->tq_avg, router_str, + seq_printf(seq, "%-17s %4i.%03is (%3i) %17s [%10s]:", + orig_str, last_seen_secs, last_seen_msecs, + orig_node->router->tq_avg, router_str, orig_node->router->if_incoming->dev);
list_for_each_entry(neigh_node, &orig_node->neigh_list, list) {