Skip to content

Commit c2edacf

Browse files
Jay VosburghJeff Garzik
authored andcommitted
bonding / ipv6: no addrconf for slaves separately from master
At present, when a device is enslaved to bonding, if ipv6 is active then addrconf will be initated on the slave (because it is closed then opened during the enslavement processing). This causes DAD and RS packets to be sent from the slave. These packets in turn can confuse switches that perform ipv6 snooping, causing them to incorrectly update their forwarding tables (if, e.g., the slave being added is an inactve backup that won't be used right away) and direct traffic away from the active slave to a backup slave (where the incoming packets will be dropped). This patch alters the behavior so that addrconf will only run on the master device itself. I believe this is logically correct, as it prevents slaves from having an IPv6 identity independent from the master. This is consistent with the IPv4 behavior for bonding. This is accomplished by (a) having bonding set IFF_SLAVE sooner in the enslavement processing than currently occurs (before open, not after), and (b) having ipv6 addrconf ignore UP and CHANGE events on slave devices. The eql driver also uses the IFF_SLAVE flag. I inspected eql, and I believe this change is reasonable for its usage of IFF_SLAVE, but I did not test it. Signed-off-by: Jay Vosburgh <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent 89c0d26 commit c2edacf

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,19 +1390,18 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
13901390
goto err_free;
13911391
}
13921392

1393+
res = netdev_set_master(slave_dev, bond_dev);
1394+
if (res) {
1395+
dprintk("Error %d calling netdev_set_master\n", res);
1396+
goto err_close;
1397+
}
13931398
/* open the slave since the application closed it */
13941399
res = dev_open(slave_dev);
13951400
if (res) {
13961401
dprintk("Openning slave %s failed\n", slave_dev->name);
13971402
goto err_restore_mac;
13981403
}
13991404

1400-
res = netdev_set_master(slave_dev, bond_dev);
1401-
if (res) {
1402-
dprintk("Error %d calling netdev_set_master\n", res);
1403-
goto err_close;
1404-
}
1405-
14061405
new_slave->dev = slave_dev;
14071406
slave_dev->priv_flags |= IFF_BONDING;
14081407

net/ipv6/addrconf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
22682268
break;
22692269
case NETDEV_UP:
22702270
case NETDEV_CHANGE:
2271+
if (dev->flags & IFF_SLAVE)
2272+
break;
2273+
22712274
if (event == NETDEV_UP) {
22722275
if (!netif_carrier_ok(dev)) {
22732276
/* device is not ready yet. */

0 commit comments

Comments
 (0)