The BATADV_ATTR_LAST_SEEN_MSECS is send from the kernel whenever it is relevant for the current local translation table entry. It is therefore not necessary to only read this value when a specific flag is or is not present in BATADV_ATTR_TT_FLAGS.
Signed-off-by: Sven Eckelmann sven@narfation.org
diff --git a/translocal.c b/translocal.c index a3ad3da57252b336399bdea8bf2ea21442c9cafe..bac6be9e9bd59c20550068495197d0d3c74564d5 100644 --- a/translocal.c +++ b/translocal.c @@ -89,15 +89,10 @@ static int translocal_callback(struct nl_msg *msg, void *arg) w = 'W'; if (flags & BATADV_TT_CLIENT_ISOLA) i = 'I'; - - if (flags & BATADV_TT_CLIENT_NOPURGE) { + if (flags & BATADV_TT_CLIENT_NOPURGE) p = 'P'; - } else { - if (!attrs[BATADV_ATTR_LAST_SEEN_MSECS]) { - fputs("Received invalid data from kernel.\n", stderr); - exit(1); - }
+ if (attrs[BATADV_ATTR_LAST_SEEN_MSECS]) { last_seen_msecs = nla_get_u32( attrs[BATADV_ATTR_LAST_SEEN_MSECS]); last_seen_secs = last_seen_msecs / 1000;