B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH] batctl: dat_cache: fix multicast/unicast filter for MAC address
Date: Sat, 04 Jul 2026 13:44:29 +0200	[thread overview]
Message-ID: <20260704-bugfixes-dat_cache-v1-1-beb52095f587@narfation.org> (raw)

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")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 dat_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dat_cache.c b/dat_cache.c
index 2dee27a..b8a9656 100644
--- a/dat_cache.c
+++ b/dat_cache.c
@@ -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,
--  
Sven Eckelmann <sven@narfation.org>


                 reply	other threads:[~2026-07-04 11:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260704-bugfixes-dat_cache-v1-1-beb52095f587@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox