Skip to contentSkip to conversation

batctl: translocal: Simplify evaluation of last_seen

PATCH Sven Eckelmann 1 participant 1 message May 10, 2021

lore
Share & tools
lore
#0 lore raw

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.

translocal.c +2 -7
index a3ad3da57252b336399bdea8bf2ea21442c9cafe..bac6be9e9bd59c20550068495197d0d3c74564d5 100644
@@ -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;