mirror-linux/net/bridge
Petr Machata cd9a9562b2 net: bridge: Install FDB for bridge MAC on VLAN 0
Currently, after the bridge is created, the FDB does not hold an FDB entry
for the bridge MAC on VLAN 0:

 # ip link add name br up type bridge
 # ip -br link show dev br
 br               UNKNOWN        92:19:8c:4e:01:ed <BROADCAST,MULTICAST,UP,LOWER_UP>
 # bridge fdb show | grep 92:19:8c:4e:01:ed
 92:19:8c:4e:01:ed dev br vlan 1 master br permanent

Later when the bridge MAC is changed, or in fact when the address is given
during netdevice creation, the entry appears:

 # ip link add name br up address 00:11:22:33:44:55 type bridge
 # bridge fdb show | grep 00:11:22:33:44:55
 00:11:22:33:44:55 dev br vlan 1 master br permanent
 00:11:22:33:44:55 dev br master br permanent

However when the bridge address is set by the user to the current bridge
address before the first port is enslaved, none of the address handlers
gets invoked, because the address is not actually changed. The address is
however marked as NET_ADDR_SET. Then when a port is enslaved, the address
is not changed, because it is NET_ADDR_SET. Thus the VLAN 0 entry is not
added, and it has not been added previously either:

 # ip link add name br up type bridge
 # ip -br link show dev br
 br               UNKNOWN        7e:f0:a8:1a:be:c2 <BROADCAST,MULTICAST,UP,LOWER_UP>
 # ip link set dev br addr 7e:f0:a8:1a:be:c2
 # ip link add name v up type veth
 # ip link set dev v master br
 # ip -br link show dev br
 br               UNKNOWN        7e:f0:a8:1a:be:c2 <BROADCAST,MULTICAST,UP,LOWER_UP>
 # bridge fdb | grep 7e:f0:a8:1a:be:c2
 7e:f0:a8:1a:be:c2 dev br vlan 1 master br permanent

Then when the bridge MAC is used as DMAC, and br_handle_frame_finish()
looks up an FDB entry with VLAN=0, it doesn't find any, and floods the
traffic instead of passing it up.

Fix this by simply adding the VLAN 0 FDB entry for the bridge itself always
on netdevice creation. This also makes the behavior consistent with how
ports are treated: ports always have an FDB entry for each member VLAN as
well as VLAN 0.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/415202b2d1b9b0899479a502bbe2ba188678f192.1758550408.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-09-23 17:10:49 -07:00
..
netfilter netfilter: nft_meta_bridge: introduce NFT_META_BRI_IIFHWADDR support 2025-09-11 15:40:55 +02:00
Kconfig
Makefile
br.c net: bridge: Install FDB for bridge MAC on VLAN 0 2025-09-23 17:10:49 -07:00
br_arp_nd_proxy.c net: bridge: Prevent unicast ARP/NS packets from being suppressed by bridge 2025-04-09 19:13:43 -07:00
br_cfm.c net: replace use of system_wq with system_percpu_wq 2025-09-22 17:40:30 -07:00
br_cfm_netlink.c bridge: cfm: fix enum typo in br_cc_ccm_tx_parse 2023-12-26 22:38:13 +00:00
br_device.c net: move misc netdev_lock flavors to a separate header 2025-03-08 09:06:50 -08:00
br_fdb.c net: bridge: Introduce UAPI for BR_BOOLOPT_FDB_LOCAL_VLAN_0 2025-09-11 19:02:50 -07:00
br_forward.c bridge: Redirect to backup port when port is administratively down 2025-08-14 17:45:36 -07:00
br_if.c net: s/dev_pre_changeaddr_notify/netif_pre_changeaddr_notify/ 2025-07-18 17:27:47 -07:00
br_input.c net: bridge: BROPT_FDB_LOCAL_VLAN_0: Look up FDB on VLAN 0 on miss 2025-09-11 19:02:50 -07:00
br_ioctl.c net: Remove RTNL dance for SIOCBRADDIF and SIOCBRDELIF. 2025-03-21 22:10:06 +01:00
br_mdb.c net: bridge: mcast: Notify on mdb offload failure 2025-04-14 15:56:43 -07:00
br_mrp.c net: replace use of system_wq with system_percpu_wq 2025-09-22 17:40:30 -07:00
br_mrp_netlink.c
br_mrp_switchdev.c
br_mst.c net: bridge: mcast: update multicast contex when vlan state is changed 2025-04-23 13:02:20 +01:00
br_multicast.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-08-21 11:33:15 -07:00
br_multicast_eht.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
br_netfilter_hooks.c netfilter: br_netfilter: do not check confirmed bit in br_nf_local_in() after confirm 2025-08-27 11:53:37 +02:00
br_netfilter_ipv6.c netfilter: bridge: replace physindev with physinif in nf_bridge_info 2024-01-17 12:02:49 +01:00
br_netlink.c net: s/dev_get_flags/netif_get_flags/ 2025-07-18 17:27:47 -07:00
br_netlink_tunnel.c net: bridge: fix an inconsistent indentation 2024-06-05 10:04:47 +01:00
br_nf_core.c bridge: netfilter: Fix forwarding of fragmented packets 2025-05-16 16:02:06 -07:00
br_private.h net: bridge: Introduce UAPI for BR_BOOLOPT_FDB_LOCAL_VLAN_0 2025-09-11 19:02:50 -07:00
br_private_cfm.h
br_private_mcast_eht.h
br_private_mrp.h
br_private_stp.h
br_private_tunnel.h bridge: always declare tunnel functions 2023-05-17 21:28:58 -07:00
br_stp.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
br_stp_bpdu.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
br_stp_if.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
br_stp_timer.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
br_switchdev.c net: s/dev_get_port_parent_id/netif_get_port_parent_id/ 2025-07-18 17:27:46 -07:00
br_sysfs_br.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
br_sysfs_if.c
br_vlan.c net: bridge: BROPT_FDB_LOCAL_VLAN_0: Skip local FDBs on VLAN creation 2025-09-11 19:02:50 -07:00
br_vlan_options.c bridge: vlan: Allow setting VLAN neighbor suppression state 2023-04-21 08:25:50 +01:00
br_vlan_tunnel.c ip_tunnel: convert __be16 tunnel flags to bitmaps 2024-04-01 10:49:28 +01:00