b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table
@ 2010-06-30  3:16 Linus Lüssing
  2010-06-30 10:21 ` Sven Eckelmann
  2010-07-01 20:32 ` Marek Lindner
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Lüssing @ 2010-06-30  3:16 UTC (permalink / raw)
  To: b.a.t.m.a.n

From: mesh-node <mesh-node@mesh-node1.(none)>

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".

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
 originator.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/originator.c b/originator.c
index c28c4f5..5343ab2 100644
--- a/originator.c
+++ b/originator.c
@@ -296,6 +296,8 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
 	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 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
 	}
 
 	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 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
 
 		addr_to_string(orig_str, orig_node->orig);
 		addr_to_string(router_str, orig_node->router->addr);
-
-		seq_printf(seq, "%-17s  (%3i) %17s [%10s]:",
-			   orig_str, orig_node->router->tq_avg, router_str,
+		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 %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) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table
  2010-06-30  3:16 [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table Linus Lüssing
@ 2010-06-30 10:21 ` Sven Eckelmann
  2010-06-30 18:23   ` Linus Lüssing
  2010-07-01 20:32 ` Marek Lindner
  1 sibling, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2010-06-30 10:21 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: Text/Plain, Size: 788 bytes --]

Linus Lüssing wrote:
> From: mesh-node <mesh-node@mesh-node1.(none)>
I think the person who applies this should remove the From and the next empty 
line... or do you have a secret dwarf named mesh-node who works for you? :D


> 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".

The rest looks good, but was a little bit irritated about the change of the 
table header (which makes sense to split it in two lines, but didn't expected 
that this patch does that).

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table
  2010-06-30 10:21 ` Sven Eckelmann
@ 2010-06-30 18:23   ` Linus Lüssing
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Lüssing @ 2010-06-30 18:23 UTC (permalink / raw)
  To: b.a.t.m.a.n

On Wed, Jun 30, 2010 at 12:21:08PM +0200, Sven Eckelmann wrote:
> Linus Lüssing wrote:
> > From: mesh-node <mesh-node@mesh-node1.(none)>
> I think the person who applies this should remove the From and the next empty 
> line... or do you have a secret dwarf named mesh-node who works for you? :D
Ah no, I wanted to keep this a secret... I also just noticed this
when I reread my post here, didn't notice the wrong From in
the patch file. Hope the commiter doesn't mind changing that to
not make other kernel devs jealous about my dwarf? :)
> 
> 
> > 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".
> 
> The rest looks good, but was a little bit irritated about the change of the 
> table header (which makes sense to split it in two lines, but didn't expected 
> that this patch does that).
Oki doki, just did that in the same patch because the extra info
made the line a little bit long. Is adding a line like this fine?

"It also puts the the versioning information in an extra line, as
the first one of this debug output would otherwise get too long."
> 
> Best regards,
> 	Sven
Thanks for reviewing, Sven

Cheers, Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table
  2010-06-30  3:16 [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table Linus Lüssing
  2010-06-30 10:21 ` Sven Eckelmann
@ 2010-07-01 20:32 ` Marek Lindner
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2010-07-01 20:32 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Wednesday 30 June 2010 05:16:21 Linus Lüssing wrote:
> 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".

I applied your patch in revision 1731 with the commit message modifications you 
suggested.

Thanks,
Marek


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-01 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30  3:16 [B.A.T.M.A.N.] [PATCH] batman-adv: Add last-seen in originator table Linus Lüssing
2010-06-30 10:21 ` Sven Eckelmann
2010-06-30 18:23   ` Linus Lüssing
2010-07-01 20:32 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).