Commit 4117d68b authored by Rundong Ge's avatar Rundong Ge Committed by Stefan Bader

net: dsa: slave: Don't propagate flag changes on down slave interfaces

BugLink: https://bugs.launchpad.net/bugs/1818813

[ Upstream commit 17ab4f61 ]

The unbalance of master's promiscuity or allmulti will happen after ifdown
and ifup a slave interface which is in a bridge.

When we ifdown a slave interface , both the 'dsa_slave_close' and
'dsa_slave_change_rx_flags' will clear the master's flags. The flags
of master will be decrease twice.
In the other hand, if we ifup the slave interface again, since the
slave's flags were cleared the 'dsa_slave_open' won't set the master's
flag, only 'dsa_slave_change_rx_flags' that triggered by 'br_add_if'
will set the master's flags. The flags of master is increase once.

Only propagating flag changes when a slave interface is up makes
sure this does not happen. The 'vlan_dev_change_rx_flags' had the
same problem and was fixed, and changes here follows that fix.

Fixes: 91da11f8 ("net: Distributed Switch Architecture protocol support")
Signed-off-by: default avatarRundong Ge <rdong.ge@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 791c1b63
...@@ -157,10 +157,14 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change) ...@@ -157,10 +157,14 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->parent->dst->master_netdev; struct net_device *master = p->parent->dst->master_netdev;
if (dev->flags & IFF_UP) {
if (change & IFF_ALLMULTI) if (change & IFF_ALLMULTI)
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1); dev_set_allmulti(master,
dev->flags & IFF_ALLMULTI ? 1 : -1);
if (change & IFF_PROMISC) if (change & IFF_PROMISC)
dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1); dev_set_promiscuity(master,
dev->flags & IFF_PROMISC ? 1 : -1);
}
} }
static void dsa_slave_set_rx_mode(struct net_device *dev) static void dsa_slave_set_rx_mode(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment