WSL2-Linux-Kernel/net/bridge
Vladimir Oltean 6ab4c3117a net: bridge: don't notify switchdev for local FDB addresses
As explained in this discussion:
https://lore.kernel.org/netdev/20210117193009.io3nungdwuzmo5f7@skbuf/

the switchdev notifiers for FDB entries managed to have a zero-day bug.
The bridge would not say that this entry is local:

ip link add br0 type bridge
ip link set swp0 master br0
bridge fdb add dev swp0 00:01:02:03:04:05 master local

and the switchdev driver would be more than happy to offload it as a
normal static FDB entry. This is despite the fact that 'local' and
non-'local' entries have completely opposite directions: a local entry
is locally terminated and not forwarded, whereas a static entry is
forwarded and not locally terminated. So, for example, DSA would install
this entry on swp0 instead of installing it on the CPU port as it should.

There is an even sadder part, which is that the 'local' flag is implicit
if 'static' is not specified, meaning that this command produces the
same result of adding a 'local' entry:

bridge fdb add dev swp0 00:01:02:03:04:05 master

I've updated the man pages for 'bridge', and after reading it now, it
should be pretty clear to any user that the commands above were broken
and should have never resulted in the 00:01:02:03:04:05 address being
forwarded (this behavior is coherent with non-switchdev interfaces):
https://patchwork.kernel.org/project/netdevbpf/cover/20210211104502.2081443-1-olteanv@gmail.com/
If you're a user reading this and this is what you want, just use:

bridge fdb add dev swp0 00:01:02:03:04:05 master static

Because switchdev should have given drivers the means from day one to
classify FDB entries as local/non-local, but didn't, it means that all
drivers are currently broken. So we can just as well omit the switchdev
notifications for local FDB entries, which is exactly what this patch
does to close the bug in stable trees. For further development work
where drivers might want to trap the local FDB entries to the host, we
can add a 'bool is_local' to br_switchdev_fdb_call_notifiers(), and
selectively make drivers act upon that bit, while all the others ignore
those entries if the 'is_local' bit is set.

Fixes: 6b26b51b1d ("net: bridge: Add support for notifying devices about FDB add/del")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-23 14:39:41 -07:00
..
netfilter netfilter: nftables: add nft_parse_register_store() and use it 2021-01-27 23:16:02 +01:00
Kconfig
Makefile net: bridge: multicast: add EHT host handling functions 2021-01-22 19:39:56 -08:00
br.c net: bridge: fix misspellings using codespell tool 2021-01-09 13:54:47 -08:00
br_arp_nd_proxy.c
br_cfm.c
br_cfm_netlink.c
br_device.c
br_fdb.c net: bridge: notify switchdev of disappearance of old FDB entry upon migration 2021-01-07 15:34:45 -08:00
br_forward.c net: bridge: check vlan with eth_type_vlan() method 2021-01-18 14:27:33 -08:00
br_if.c
br_input.c net: bridge: fix misspellings using codespell tool 2021-01-09 13:54:47 -08:00
br_ioctl.c
br_mdb.c
br_mrp.c bridge: mrp: Update br_mrp to use new return values of br_mrp_switchdev 2021-02-16 14:47:46 -08:00
br_mrp_netlink.c
br_mrp_switchdev.c bridge: mrp: Extend br_mrp_switchdev to detect better the errors 2021-02-16 14:47:46 -08:00
br_multicast.c net: bridge: propagate extack through switchdev_port_attr_set 2021-02-14 17:38:11 -08:00
br_multicast_eht.c net: bridge: multicast: make tracked EHT hosts limit configurable 2021-01-27 17:40:35 -08:00
br_netfilter_hooks.c
br_netfilter_ipv6.c
br_netlink.c net: bridge: propagate extack through switchdev_port_attr_set 2021-02-14 17:38:11 -08:00
br_netlink_tunnel.c
br_nf_core.c
br_private.h net: bridge: fix br_vlan_filter_toggle stub when CONFIG_BRIDGE_VLAN_FILTERING=n 2021-02-15 13:15:10 -08:00
br_private_cfm.h
br_private_mcast_eht.h net: bridge: multicast: make tracked EHT hosts limit configurable 2021-01-27 17:40:35 -08:00
br_private_mrp.h bridge: mrp: Extend br_mrp_switchdev to detect better the errors 2021-02-16 14:47:46 -08:00
br_private_stp.h
br_private_tunnel.h
br_stp.c net: bridge: propagate extack through switchdev_port_attr_set 2021-02-14 17:38:11 -08:00
br_stp_bpdu.c
br_stp_if.c
br_stp_timer.c
br_switchdev.c net: bridge: don't notify switchdev for local FDB addresses 2021-03-23 14:39:41 -07:00
br_sysfs_br.c net: bridge: propagate extack through store_bridge_parm 2021-02-14 17:38:11 -08:00
br_sysfs_if.c net: bridge: don't print in br_switchdev_set_port_flag 2021-02-12 17:08:04 -08:00
br_vlan.c net: bridge: propagate extack through switchdev_port_attr_set 2021-02-14 17:38:11 -08:00
br_vlan_options.c
br_vlan_tunnel.c