Skip to content

Commit 59070cc

Browse files
Blubgregkh
authored andcommitted
net: bridge: sync fdb to new unicast-filtering ports
commit a019abd upstream. Since commit 2796d0c ("bridge: Automatically manage port promiscuous mode.") bridges with `vlan_filtering 1` and only 1 auto-port don't set IFF_PROMISC for unicast-filtering-capable ports. Normally on port changes `br_manage_promisc` is called to update the promisc flags and unicast filters if necessary, but it cannot distinguish between *new* ports and ones losing their promisc flag, and new ports end up not receiving the MAC address list. Fix this by calling `br_fdb_sync_static` in `br_add_if` after the port promisc flags are updated and the unicast filter was supposed to have been filled. Fixes: 2796d0c ("bridge: Automatically manage port promiscuous mode.") Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7b5a291 commit 59070cc

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎net/bridge/br_if.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
561561
struct net_bridge_port *p;
562562
int err = 0;
563563
unsigned br_hr, dev_hr;
564-
bool changed_addr;
564+
bool changed_addr, fdb_synced = false;
565565

566566
/* Don't allow bridging non-ethernet like devices. */
567567
if ((dev->flags & IFF_LOOPBACK) ||
@@ -651,6 +651,19 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
651651
list_add_rcu(&p->list, &br->port_list);
652652

653653
nbp_update_port_count(br);
654+
if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) {
655+
/* When updating the port count we also update all ports'
656+
* promiscuous mode.
657+
* A port leaving promiscuous mode normally gets the bridge's
658+
* fdb synced to the unicast filter (if supported), however,
659+
* `br_port_clear_promisc` does not distinguish between
660+
* non-promiscuous ports and *new* ports, so we need to
661+
* sync explicitly here.
662+
*/
663+
fdb_synced = br_fdb_sync_static(br, p) == 0;
664+
if (!fdb_synced)
665+
netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n");
666+
}
654667

655668
netdev_update_features(br->dev);
656669

@@ -700,6 +713,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
700713
return 0;
701714

702715
err7:
716+
if (fdb_synced)
717+
br_fdb_unsync_static(br, p);
703718
list_del_rcu(&p->list);
704719
br_fdb_delete_by_port(br, p, 0, 1);
705720
nbp_update_port_count(br);

0 commit comments

Comments
 (0)