]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: bridge: BROPT_FDB_LOCAL_VLAN_0: On bridge changeaddr, skip per-VLAN FDBs
authorPetr Machata <petrm@nvidia.com>
Thu, 4 Sep 2025 17:07:21 +0000 (19:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 12 Sep 2025 02:02:50 +0000 (19:02 -0700)
When BROPT_FDB_LOCAL_VLAN_0 is enabled, the local FDB entries for the
bridge itself should not be created per-VLAN, but instead only on VLAN 0.
When the bridge address changes, the local FDB entries need to be updated,
which is done in br_fdb_change_mac_address().

Bail out early when in VLAN-0 mode, so that the per-VLAN FDB entries are
not created. The per-VLAN walk is only done afterwards.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/0bd432cf91921ef7c4ed0e129de1d1cd358c716b.1757004393.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/bridge/br_fdb.c

index 918c375546386a2c34a8aee4e3b7b75919ffca97..4a20578517a54cc8ed9cf6d54ae8218b5c74a1a6 100644 (file)
@@ -503,6 +503,9 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr)
        struct net_bridge_vlan_group *vg;
        struct net_bridge_fdb_entry *f;
        struct net_bridge_vlan *v;
+       bool local_vlan_0;
+
+       local_vlan_0 = br_opt_get(br, BROPT_FDB_LOCAL_VLAN_0);
 
        spin_lock_bh(&br->hash_lock);
 
@@ -514,7 +517,7 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr)
 
        fdb_add_local(br, NULL, newaddr, 0);
        vg = br_vlan_group(br);
-       if (!vg || !vg->num_vlans)
+       if (!vg || !vg->num_vlans || local_vlan_0)
                goto out;
        /* Now remove and add entries for every VLAN configured on the
         * bridge.  This function runs under RTNL so the bitmap will not