Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp685976pxv; Thu, 22 Jul 2021 09:42:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHEreOPlShezNWtTyjscxIBWsTBG08Ei5KXZJwM/Cfb+qNBXBGLUkhHcJ67qXFxvTCamSi X-Received: by 2002:a92:b741:: with SMTP id c1mr500417ilm.220.1626972167978; Thu, 22 Jul 2021 09:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626972167; cv=none; d=google.com; s=arc-20160816; b=iM8wzyUJ5Vya/Jo9LneP9oDm45YDerDbUn12OOftwpQ7Ecvj0r85KZCuzNaVEih4wP GELlm+JsaeaTqGtnqiUTU3c2JCrQSdAqDxzHX/ALkYurlwwx5QYp3i2dpKkLabWiQYso fbsvDqfRVF721IDlocKNMvJbg12TfInV1i3wApUW3qZCTVWIQHgknGKArE8K7yib6R7Z Eh66ugh38S2KjcRnr2TLGfZ2EZW91+9meu/irJ4xiOW54ozmkZvwyD7lj+So8RwTovOc qir5DFpcpFMMZfRpV7C44P6kH6CXaDSxb/inULejCgXYQffI1DUtoylyBbwklyJe9vBC xkjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9H25/Q/UpNF1ixml5WowCbNBxHZEf08Y7ce6aDbD20c=; b=WQIL/hCM825cyFutGRpJWwZjzyAReOxB9k/Es40ZhFcSFe9zIn0WgIa2JgZXc/HMqG W146kYzGUd5oPeCIl27wvceVCjKkcjO5N8o5a2NWCcSiDqentEszm417/iJITq4c8Y9N nKVV/ZX3McTxllzdGWHJHxtjv6GEodTtxudRW520dPHLHFWyj9LZP1yzkJ1K43AFI1ii UFGRdJ7RKOelssSmdqn0RiRJ7mdb2Dcl2sqR2RxqGjZgZRgmNfYbUb7GCO+W+EzRpgKb L2De9T4Msfk4gRlXreCbVo/mg9+2qoNpHo2MCHkLwnO2Q7MTBLb3sItJGEtoh3IxY51E ss1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OLivPsiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si9539353ila.59.2021.07.22.09.42.36; Thu, 22 Jul 2021 09:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OLivPsiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233064AbhGVQBS (ORCPT + 99 others); Thu, 22 Jul 2021 12:01:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233426AbhGVP7B (ORCPT ); Thu, 22 Jul 2021 11:59:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C37DF610F7; Thu, 22 Jul 2021 16:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626971976; bh=EnC1i3mxeQTXxGVZlP2SS/Fr1Mld2kkgNBRmzV4Q+uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OLivPsiEgv9o7nM3lAOdJ+IeH/BzqkNp+OxoSLzgrzDrwsWB0/3KwSRkodjhGAFTA MtL/4iEmyZoA3lyhOy+kwunByv/QRERtY92piY7nhNpCloCP3z/eIO3PyBevcqcgVG lKr2l+Whs+93YtQgKCPHbdifTLZjC63mbAtDcKkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfgang Bumiller , Nikolay Aleksandrov , "David S. Miller" Subject: [PATCH 5.10 099/125] net: bridge: sync fdb to new unicast-filtering ports Date: Thu, 22 Jul 2021 18:31:30 +0200 Message-Id: <20210722155627.981433005@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210722155624.672583740@linuxfoundation.org> References: <20210722155624.672583740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfgang Bumiller commit a019abd8022061b917da767cd1a66ed823724eab upstream. 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. Fixes: 2796d0c648c9 ("bridge: Automatically manage port promiscuous mode.") Signed-off-by: Wolfgang Bumiller Acked-by: Nikolay Aleksandrov Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/bridge/br_if.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -561,7 +561,7 @@ int br_add_if(struct net_bridge *br, str struct net_bridge_port *p; int err = 0; unsigned br_hr, dev_hr; - bool changed_addr; + bool changed_addr, fdb_synced = false; /* Don't allow bridging non-ethernet like devices. */ if ((dev->flags & IFF_LOOPBACK) || @@ -651,6 +651,19 @@ int br_add_if(struct net_bridge *br, str 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. + */ + fdb_synced = br_fdb_sync_static(br, p) == 0; + if (!fdb_synced) + netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n"); + } netdev_update_features(br->dev); @@ -700,6 +713,8 @@ int br_add_if(struct net_bridge *br, str return 0; err7: + if (fdb_synced) + br_fdb_unsync_static(br, p); list_del_rcu(&p->list); br_fdb_delete_by_port(br, p, 0, 1); nbp_update_port_count(br);