Skip to contentSkip to conversation

batctl: dat_cache: fix multicast/unicast filter for MAC address

PATCH New Sven Eckelmann 1 participant 1 message Jul 4

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batctl: dat_cache: fix multicast/unicast filter for MAC address

The -u/-m filters in the DAT cache callback test addr[0], but addr in this callback is function is the text representation of the mac address - not the binary representation like in all other functions. The binary check of the multicast-bit will therefore not correctly identify multicast entries.

The kernel reply BATADV_ATTR_DAT_CACHE_HWADDRESS has to be checked instead.

Fixes d8dd1ff1a0fe ("batctl: Use netlink to replace some of debugfs")
---
 dat_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
dat_cache.c +2 -2
index 2dee27a..b8a9656 100644
@@ -78,10 +78,10 @@ static int dat_cache_callback(struct nl_msg *msg, void *arg)
 	last_seen_msecs = last_seen_msecs % 60000;
 	last_seen_secs = last_seen_msecs / 1000;
 
-	if (opts->read_opt & MULTICAST_ONLY && !(addr[0] & 0x01))
+	if (opts->read_opt & MULTICAST_ONLY && !(hwaddr[0] & 0x01))
 		return NL_OK;
 
-	if (opts->read_opt & UNICAST_ONLY && (addr[0] & 0x01))
+	if (opts->read_opt & UNICAST_ONLY && (hwaddr[0] & 0x01))
 		return NL_OK;
 
 	printf(" * %15s ", addr);

---
base-commit: e93995999e80513db80eba200ea682b5b15556af
change-id: 20260704-bugfixes-dat_cache-4d73b5b4a5b6

Best regards,

Signature · 1 line
Sven Eckelmann <[email protected]>