public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: don't print the last_seen time for bat0 TT local entry
@ 2012-11-29  0:54 Antonio Quartulli
  2012-11-29  3:18 ` Marek Lindner
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2012-11-29  0:54 UTC (permalink / raw)
  To: b.a.t.m.a.n

bat0 MAC address will never deleted from the local translation table, therefore
printing its last_Seen time is useless and will also produce ugly output and
eventually a variable overflow.

This was introduced by 59cb0861498776c62bd17584c31f34477fa301a0 ("batman-adv:
improve local translation table output")

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 translation-table.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/translation-table.c b/translation-table.c
index 1335294..0b29119 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -478,6 +478,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 	int last_seen_secs;
 	int last_seen_msecs;
 	unsigned long last_seen_jiffies;
+	bool no_purge;
 
 	primary_if = batadv_seq_print_text_primary_if_get(seq);
 	if (!primary_if)
@@ -504,19 +505,22 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
 			last_seen_secs = last_seen_msecs / 1000;
 			last_seen_msecs = last_seen_msecs % 1000;
 
+			no_purge = tt_common_entry->flags &
+				   BATADV_TT_CLIENT_NOPURGE;
+
 			seq_printf(seq, " * %pM [%c%c%c%c%c] %3u.%03u\n",
 				   tt_common_entry->addr,
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_ROAM ? 'R' : '.'),
-				   (tt_common_entry->flags &
-				    BATADV_TT_CLIENT_NOPURGE ? 'P' : '.'),
+				   no_purge ? 'P' : '.',
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_NEW ? 'N' : '.'),
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_PENDING ? 'X' : '.'),
 				   (tt_common_entry->flags &
 				    BATADV_TT_CLIENT_WIFI ? 'W' : '.'),
-				   last_seen_secs, last_seen_msecs);
+				   no_purge ? last_seen_secs : 0,
+				   no_purge ? last_seen_msecs : 0);
 		}
 		rcu_read_unlock();
 	}
-- 
1.8.0


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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't print the last_seen time for bat0 TT local entry
  2012-11-29  0:54 [B.A.T.M.A.N.] [PATCH] batman-adv: don't print the last_seen time for bat0 TT local entry Antonio Quartulli
@ 2012-11-29  3:18 ` Marek Lindner
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2012-11-29  3:18 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, November 29, 2012 08:54:22 Antonio Quartulli wrote:
> @@ -504,19 +505,22 @@ int batadv_tt_local_seq_print_text(struct seq_file
> *seq, void *offset) last_seen_secs = last_seen_msecs / 1000;
>                         last_seen_msecs = last_seen_msecs % 1000;
>  
> +                       no_purge = tt_common_entry->flags &
> +                                  BATADV_TT_CLIENT_NOPURGE;


Do you think David will accept this ?

Cheers,
Marek

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

end of thread, other threads:[~2012-11-29  3:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29  0:54 [B.A.T.M.A.N.] [PATCH] batman-adv: don't print the last_seen time for bat0 TT local entry Antonio Quartulli
2012-11-29  3:18 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox