Skip to contentSkip to conversation

alfred: vis: Fix direct neighbors detection with netlink query

PATCH Applied Sven Eckelmann 2 participants 2 messages Sep 23, 2016 – Oct 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alfred: vis: Fix direct neighbors detection with netlink query

Only entries in the originator table with the destination address equal to the originator address should be handled by alfred as actual neighbors.

Fixes bca55a86fecd ("alfred: vis: Add support for netlink")
---
 vis/vis.c | 6 ++++++
 1 file changed, 6 insertions(+)
vis/vis.c +6 -0
index 94e583e..f4d13c7 100644
@@ -453,6 +453,7 @@ err:
 
 static const int parse_orig_list_mandatory[] = {
 	BATADV_ATTR_ORIG_ADDRESS,
+	BATADV_ATTR_NEIGH_ADDRESS,
 	BATADV_ATTR_TQ,
 	BATADV_ATTR_HARD_IFINDEX,
 };
@@ -466,6 +467,7 @@ static int parse_orig_list_netlink_cb(struct nl_msg *msg, void *arg)
 	struct genlmsghdr *ghdr;
 	struct vis_list_entry *v_entry;
 	uint8_t *orig;
+	uint8_t *neigh;
 	uint8_t tq;
 	uint32_t hardif;
 
@@ -493,12 +495,16 @@ static int parse_orig_list_netlink_cb(struct nl_msg *msg, void *arg)
 		return NL_OK;
 
 	orig = nla_data(attrs[BATADV_ATTR_ORIG_ADDRESS]);
+	neigh = nla_data(attrs[BATADV_ATTR_NEIGH_ADDRESS]);
 	tq = nla_get_u8(attrs[BATADV_ATTR_TQ]);
 	hardif = nla_get_u32(attrs[BATADV_ATTR_HARD_IFINDEX]);
 
 	if (tq < 1)
 		return NL_OK;
 
+	if (memcmp(orig, neigh, ETH_ALEN) != 0)
+		return NL_OK;
+
 	v_entry = malloc(sizeof(*v_entry));
 	if (!v_entry)
 		return NL_OK;
Signature · 1 line
2.9.3
#1 lore raw
Quoted 5 lines · CEST Sven Eckelmann

Only entries in the originator table with the destination address equal to the originator address should be handled by alfred as actual neighbors.

Fixes bca55a86fecd ("alfred: vis: Add support for netlink")

Applied in revision a3fb7d0

Thanks!
Simon