Skip to content

Commit 17ab4f6

Browse files
Rundong Gedavem330
authored andcommitted
net: dsa: slave: Don't propagate flag changes on down slave interfaces
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: 91da11f ("net: Distributed Switch Architecture protocol support") Signed-off-by: Rundong Ge <rdong.ge@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0429f23 commit 17ab4f6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/dsa/slave.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,14 @@ static int dsa_slave_close(struct net_device *dev)
140140
static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
141141
{
142142
struct net_device *master = dsa_slave_to_master(dev);
143-
144-
if (change & IFF_ALLMULTI)
145-
dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
146-
if (change & IFF_PROMISC)
147-
dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1);
143+
if (dev->flags & IFF_UP) {
144+
if (change & IFF_ALLMULTI)
145+
dev_set_allmulti(master,
146+
dev->flags & IFF_ALLMULTI ? 1 : -1);
147+
if (change & IFF_PROMISC)
148+
dev_set_promiscuity(master,
149+
dev->flags & IFF_PROMISC ? 1 : -1);
150+
}
148151
}
149152

150153
static void dsa_slave_set_rx_mode(struct net_device *dev)

0 commit comments

Comments
 (0)