diff options
author | Joachim Wiberg <troglobit@gmail.com> | 2022-03-30 15:36:20 (GMT) |
---|---|---|
committer | Joachim Wiberg <troglobit@gmail.com> | 2022-03-30 15:36:20 (GMT) |
commit | 930fc119d5e478e99090d240f6d9af9964bb509d (patch) | |
tree | 41357bd13efeb3d0acc5ffdd676deb3380786c0f | |
parent | 2d68cafa285e3683a3a360d26728d34d6eea4073 (diff) | |
download | libnl-930fc119d5e478e99090d240f6d9af9964bb509d.zip libnl-930fc119d5e478e99090d240f6d9af9964bb509d.tar.gz libnl-930fc119d5e478e99090d240f6d9af9964bb509d.tar.bz2 |
route/mdb: add support for MAC multicast entries
The kernel bridge now support (permanent) forwarding of MAC multicast
using the MDB. Internally the kernel use AF_UNSPEC, but we remap this
here to AF_LLC for the benefit for nl_addrs.
To test, put `nl-monitor mdb` in the background. Then, with a bridge
and at least one port, run the following command:
# nl-monitor mdb &
# bridge mdb add dev br0 port eth0 grp 01:02:03:c0:ff:ee vid 1 permanent
dev 9
port 3 vid 1 proto 0x0000 address 01:02:03:c0:ff:ee
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
-rw-r--r-- | include/linux-private/linux/if_bridge.h | 1 | ||||
-rw-r--r-- | lib/route/mdb.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/linux-private/linux/if_bridge.h b/include/linux-private/linux/if_bridge.h index bdfecf9..e206aa8 100644 --- a/include/linux-private/linux/if_bridge.h +++ b/include/linux-private/linux/if_bridge.h @@ -243,6 +243,7 @@ struct br_mdb_entry { union { __be32 ip4; struct in6_addr ip6; + unsigned char mac_addr[ETH_ALEN]; } u; __be16 proto; } addr; diff --git a/lib/route/mdb.c b/lib/route/mdb.c index 43be05c..894a0bb 100644 --- a/lib/route/mdb.c +++ b/lib/route/mdb.c @@ -232,7 +232,12 @@ static int mdb_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, entry->addr = nl_addr_build(AF_INET6, &e->addr.u.ip6, sizeof(e->addr.u.ip6)); + } else { + entry->addr = nl_addr_build(AF_LLC, + e->addr.u.mac_addr, + sizeof(e->addr.u.mac_addr)); } + if (!entry->addr) goto errout; |