Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtnetlink: bridge: mcast: Relax group address validation in common code

In the upcoming VXLAN MDB implementation, the 0.0.0.0 and :: MDB entries
will act as catchall entries for unregistered IP multicast traffic in a
similar fashion to the 00:00:00:00:00:00 VXLAN FDB entry that is used to
transmit BUM traffic.

In deployments where inter-subnet multicast forwarding is used, not all
the VTEPs in a tenant domain are members in all the broadcast domains.
It is therefore advantageous to transmit BULL (broadcast, unknown
unicast and link-local multicast) and unregistered IP multicast traffic
on different tunnels. If the same tunnel was used, a VTEP only
interested in IP multicast traffic would also pull all the BULL traffic
and drop it as it is not a member in the originating broadcast domain
[1].

Prepare for this change by allowing the 0.0.0.0 group address in the
common rtnetlink MDB code and forbid it in the bridge driver. A similar
change is not needed for IPv6 because the common code only validates
that the group address is not the all-nodes address.

[1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-2.6

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
da654c80 cc7f5022

+9 -2
+6
net/bridge/br_mdb.c
··· 1246 1246 } 1247 1247 } 1248 1248 1249 + if (cfg->entry->addr.proto == htons(ETH_P_IP) && 1250 + ipv4_is_zeronet(cfg->entry->addr.u.ip4)) { 1251 + NL_SET_ERR_MSG_MOD(extack, "IPv4 entry group address 0.0.0.0 is not allowed"); 1252 + return -EINVAL; 1253 + } 1254 + 1249 1255 if (tb[MDBA_SET_ENTRY_ATTRS]) 1250 1256 return br_mdb_config_attrs_init(tb[MDBA_SET_ENTRY_ATTRS], cfg, 1251 1257 extack);
+3 -2
net/core/rtnetlink.c
··· 6152 6152 } 6153 6153 6154 6154 if (entry->addr.proto == htons(ETH_P_IP)) { 6155 - if (!ipv4_is_multicast(entry->addr.u.ip4)) { 6156 - NL_SET_ERR_MSG(extack, "IPv4 entry group address is not multicast"); 6155 + if (!ipv4_is_multicast(entry->addr.u.ip4) && 6156 + !ipv4_is_zeronet(entry->addr.u.ip4)) { 6157 + NL_SET_ERR_MSG(extack, "IPv4 entry group address is not multicast or 0.0.0.0"); 6157 6158 return -EINVAL; 6158 6159 } 6159 6160 if (ipv4_is_local_multicast(entry->addr.u.ip4)) {