Commit 43c2adb9 authored by Hangbin Liu's avatar Hangbin Liu Committed by David S. Miller

team: set slave to promisc if team is already in promisc mode

After adding a team interface to bridge, the team interface will enter
promisc mode. Then if we add a new slave to team0, the slave will keep
promisc off. Fix it by setting slave to promisc on if team master is
already in promisc mode, also do the same for allmulti.

v2: add promisc and allmulti checking when delete ports

Fixes: 3d249d4c ("net: introduce ethernet teaming device")
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 903f1a18
...@@ -1246,6 +1246,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev, ...@@ -1246,6 +1246,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
goto err_option_port_add; goto err_option_port_add;
} }
/* set promiscuity level to new slave */
if (dev->flags & IFF_PROMISC) {
err = dev_set_promiscuity(port_dev, 1);
if (err)
goto err_set_slave_promisc;
}
/* set allmulti level to new slave */
if (dev->flags & IFF_ALLMULTI) {
err = dev_set_allmulti(port_dev, 1);
if (err) {
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(port_dev, -1);
goto err_set_slave_promisc;
}
}
netif_addr_lock_bh(dev); netif_addr_lock_bh(dev);
dev_uc_sync_multiple(port_dev, dev); dev_uc_sync_multiple(port_dev, dev);
dev_mc_sync_multiple(port_dev, dev); dev_mc_sync_multiple(port_dev, dev);
...@@ -1262,6 +1279,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev, ...@@ -1262,6 +1279,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return 0; return 0;
err_set_slave_promisc:
__team_option_inst_del_port(team, port);
err_option_port_add: err_option_port_add:
team_upper_dev_unlink(team, port); team_upper_dev_unlink(team, port);
...@@ -1307,6 +1327,12 @@ static int team_port_del(struct team *team, struct net_device *port_dev) ...@@ -1307,6 +1327,12 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
team_port_disable(team, port); team_port_disable(team, port);
list_del_rcu(&port->list); list_del_rcu(&port->list);
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(port_dev, -1);
if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(port_dev, -1);
team_upper_dev_unlink(team, port); team_upper_dev_unlink(team, port);
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
team_port_disable_netpoll(port); team_port_disable_netpoll(port);
......
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