Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hangbin Liu and committed by
David S. Miller
43c2adb9 903f1a18

+26
+26
drivers/net/team/team.c
··· 1246 1246 goto err_option_port_add; 1247 1247 } 1248 1248 1249 + /* set promiscuity level to new slave */ 1250 + if (dev->flags & IFF_PROMISC) { 1251 + err = dev_set_promiscuity(port_dev, 1); 1252 + if (err) 1253 + goto err_set_slave_promisc; 1254 + } 1255 + 1256 + /* set allmulti level to new slave */ 1257 + if (dev->flags & IFF_ALLMULTI) { 1258 + err = dev_set_allmulti(port_dev, 1); 1259 + if (err) { 1260 + if (dev->flags & IFF_PROMISC) 1261 + dev_set_promiscuity(port_dev, -1); 1262 + goto err_set_slave_promisc; 1263 + } 1264 + } 1265 + 1249 1266 netif_addr_lock_bh(dev); 1250 1267 dev_uc_sync_multiple(port_dev, dev); 1251 1268 dev_mc_sync_multiple(port_dev, dev); ··· 1278 1261 netdev_info(dev, "Port device %s added\n", portname); 1279 1262 1280 1263 return 0; 1264 + 1265 + err_set_slave_promisc: 1266 + __team_option_inst_del_port(team, port); 1281 1267 1282 1268 err_option_port_add: 1283 1269 team_upper_dev_unlink(team, port); ··· 1327 1307 1328 1308 team_port_disable(team, port); 1329 1309 list_del_rcu(&port->list); 1310 + 1311 + if (dev->flags & IFF_PROMISC) 1312 + dev_set_promiscuity(port_dev, -1); 1313 + if (dev->flags & IFF_ALLMULTI) 1314 + dev_set_allmulti(port_dev, -1); 1315 + 1330 1316 team_upper_dev_unlink(team, port); 1331 1317 netdev_rx_handler_unregister(port_dev); 1332 1318 team_port_disable_netpoll(port);