From 998cb86d48c0ee8b61d35b0f94937732cf245da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Sat, 31 Mar 2018 19:12:43 +0200 Subject: [PATCH] gluon-ebtables-limit-arp: do not add multicast addresses to filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the batman-adv multicast support compiled back in again we end up with multicast addresses in the batman-adv translation table. Currently we wrongly interpret multicast addresses returned by TT as a unique host, too, which adds them with a source address filter to ebtables as well. However, the source address of an ethernet frames is never supposed to be a multicat one. This leads to unnecessary entries in ebtables. Fixing this by ignoring those MAC addreses returned by TT which have the multicast bit set. Signed-off-by: Linus Lüssing --- package/gluon-ebtables-limit-arp/src/gluon-arp-limiter.c | 3 +++ package/gluon-ebtables-limit-arp/src/mac.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/package/gluon-ebtables-limit-arp/src/gluon-arp-limiter.c b/package/gluon-ebtables-limit-arp/src/gluon-arp-limiter.c index af4acf48..cbb6faf2 100644 --- a/package/gluon-ebtables-limit-arp/src/gluon-arp-limiter.c +++ b/package/gluon-ebtables-limit-arp/src/gluon-arp-limiter.c @@ -248,6 +248,9 @@ static void ebt_tl_update(void) break; } + if (mac_is_multicast(&mac)) + continue; + ebt_add_mac(&mac); } diff --git a/package/gluon-ebtables-limit-arp/src/mac.h b/package/gluon-ebtables-limit-arp/src/mac.h index e6191736..11567ade 100644 --- a/package/gluon-ebtables-limit-arp/src/mac.h +++ b/package/gluon-ebtables-limit-arp/src/mac.h @@ -16,4 +16,9 @@ struct mac_addr { int mac_aton(const char *cp, struct mac_addr *mac); char *mac_ntoa(struct mac_addr *mac); +static inline int mac_is_multicast(struct mac_addr *addr) +{ + return addr->storage[0] & 0x01; +} + #endif /* _MAC_H_ */