The IP to mac translation code already skips zero and multicast mac addressses because there might be multiple entries in the global translation table which would match this entry. There is no "best" entry originator for such an entry and such the result is basically a random pick.
Translating such an input mac address (from ping/traceoute/translate) to a single originator address is therefore not appropriate.
Signed-off-by: Sven Eckelmann sven@narfation.org --- functions.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/functions.c b/functions.c index 3c340a2..e0e9978 100644 --- a/functions.c +++ b/functions.c @@ -194,6 +194,19 @@ static int str_is_mcast_addr(char *addr) mac_addr->ether_addr_octet[0] & 0x01; }
+static bool ether_addr_valid(const uint8_t *addr) +{ + /* no multicast address */ + if (addr[0] & 0x01) + return false; + + /* no zero address */ + if ((addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]) == 0) + return false; + + return true; +} + int read_file(const char *dir, const char *fname, int read_opt, float orig_timeout, float watch_interval, size_t header_lines) { @@ -475,6 +488,9 @@ struct ether_addr *translate_mac(const char *mesh_iface, memcpy(&out_mac, mac, sizeof(out_mac)); mac_result = &out_mac;
+ if (!ether_addr_valid(in_mac.ether_addr_octet)) + return mac_result; + ret = translate_mac_netlink(mesh_iface, &in_mac, mac_result);
if (ret == -EOPNOTSUPP) @@ -571,19 +587,6 @@ static struct nla_policy neigh_policy[NDA_MAX+1] = { [NDA_PROBES] = { .type = NLA_U32 }, };
-static bool ether_addr_valid(const uint8_t *addr) -{ - /* no multicast address */ - if (addr[0] & 0x01) - return false; - - /* no zero address */ - if ((addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]) == 0) - return false; - - return true; -} - static int resolve_mac_from_parse(struct nl_msg *msg, void *arg) { struct nlattr *tb[NDA_MAX + 1];
On Donnerstag, 19. April 2018 20:14:20 CEST Sven Eckelmann wrote:
Instead of disabling multicast optimizations mesh-wide once a node with no multicast optimizations capabilities joins the mesh, do the following:
Just insert such nodes into the WANT_ALL_IPV4/IPV6 lists. This is sufficient to avoid multicast packet loss to such unsupportive nodes.
Signed-off-by: Linus Lüssing linus.luessing@c0d3.blue
net/batman-adv/multicast.c | 29 ++++++----------------------- net/batman-adv/soft-interface.c | 1 - net/batman-adv/types.h | 3 --- 3 files changed, 6 insertions(+), 27 deletions(-)
Patch added as 70968bb67d4d [1]
Kind regards, Sven
[1] https://git.open-mesh.org/batctl.git/commit/70968bb67d4da6f3c9349697a702dda4...
b.a.t.m.a.n@lists.open-mesh.org