All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: netdev@vger.kernel.org
Cc: bridge@lists.linux-foundation.org,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Nikolay Aleksandrov <nikolay@nvidia.com>,
	Roopa Prabhu <roopa@nvidia.com>,
	Vlad Yasevich <vyasevic@redhat.com>,
	Thomas Lamprecht <t.lamprecht@proxmox.com>
Subject: [PATCH 1/1] net: bridge: sync fdb to new unicast-filtering ports
Date: Thu,  1 Jul 2021 14:28:30 +0200	[thread overview]
Message-ID: <20210701122830.2652-2-w.bumiller@proxmox.com> (raw)
In-Reply-To: <20210701122830.2652-1-w.bumiller@proxmox.com>

Since commit 2796d0c648c9 ("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.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 net/bridge/br_if.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f7d2f472ae24..183e72e7b65e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -652,6 +652,18 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
 	list_add_rcu(&p->list, &br->port_list);
 
 	nbp_update_port_count(br);
+	if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) {
+		/* When updating the port count we also update all ports'
+		 * promiscuous mode.
+		 * A port leaving promiscuous mode normally gets the bridge's
+		 * fdb synced to the unicast filter (if supported), however,
+		 * `br_port_clear_promisc` does not distinguish between
+		 * non-promiscuous ports and *new* ports, so we need to
+		 * sync explicitly here.
+		 */
+		if (br_fdb_sync_static(br, p))
+			netdev_err(dev, "failed to sync bridge addresses to this port\n");
+	}
 
 	netdev_update_features(br->dev);
 
-- 
2.32.0



WARNING: multiple messages have this Message-ID (diff)
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: netdev@vger.kernel.org
Cc: Vlad Yasevich <vyasevic@redhat.com>,
	bridge@lists.linux-foundation.org,
	Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Nikolay Aleksandrov <nikolay@nvidia.com>,
	Roopa Prabhu <roopa@nvidia.com>, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [Bridge] [PATCH 1/1] net: bridge: sync fdb to new unicast-filtering ports
Date: Thu,  1 Jul 2021 14:28:30 +0200	[thread overview]
Message-ID: <20210701122830.2652-2-w.bumiller@proxmox.com> (raw)
In-Reply-To: <20210701122830.2652-1-w.bumiller@proxmox.com>

Since commit 2796d0c648c9 ("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.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 net/bridge/br_if.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f7d2f472ae24..183e72e7b65e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -652,6 +652,18 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
 	list_add_rcu(&p->list, &br->port_list);
 
 	nbp_update_port_count(br);
+	if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) {
+		/* When updating the port count we also update all ports'
+		 * promiscuous mode.
+		 * A port leaving promiscuous mode normally gets the bridge's
+		 * fdb synced to the unicast filter (if supported), however,
+		 * `br_port_clear_promisc` does not distinguish between
+		 * non-promiscuous ports and *new* ports, so we need to
+		 * sync explicitly here.
+		 */
+		if (br_fdb_sync_static(br, p))
+			netdev_err(dev, "failed to sync bridge addresses to this port\n");
+	}
 
 	netdev_update_features(br->dev);
 
-- 
2.32.0



  reply	other threads:[~2021-07-01 12:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 12:28 [PATCH 0/1] Fixup unicast filter for new vlan-aware-bridge ports Wolfgang Bumiller
2021-07-01 12:28 ` [Bridge] " Wolfgang Bumiller
2021-07-01 12:28 ` Wolfgang Bumiller [this message]
2021-07-01 12:28   ` [Bridge] [PATCH 1/1] net: bridge: sync fdb to new unicast-filtering ports Wolfgang Bumiller
2021-07-01 13:49   ` Nikolay Aleksandrov
2021-07-01 13:49     ` [Bridge] " Nikolay Aleksandrov
2021-07-01 14:51     ` Thomas Lamprecht
2021-07-01 14:51       ` [Bridge] " Thomas Lamprecht
2021-07-01 15:33       ` Nikolay Aleksandrov
2021-07-01 15:33         ` [Bridge] " Nikolay Aleksandrov
2021-07-02  7:34         ` Wolfgang Bumiller
2021-07-02  7:34           ` [Bridge] " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210701122830.2652-2-w.bumiller@proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    --cc=roopa@nvidia.com \
    --cc=t.lamprecht@proxmox.com \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.