aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2006-09-23 00:54:10 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-25 20:08:09 -0400
commit0b680e753724d31a9c45f059d1aad29df54584a1 (patch)
tree02f121ee2804e63d17015907da3b2c51d81223be /drivers/net/bonding
parent54ef313714070b397d3857289f0fd099b7643631 (diff)
[PATCH] bonding: Add priv_flag to avoid event mishandling
Add priv_flag to specifically identify bonding-involved devices. Needed because IFF_MASTER is an unreliable identifier (vlan interfaces above bonding will inherit IFF_MASTER). Misidentification of devices would cause notifier events for other devices to be erroneously processed by bonding, causing various havoc. Bug discovered by Martin Papik <martin.papik@ipsec.info>; this patch is modified from his original. Signed-off-by: Martin Papik <martin.papik@ipsec.info> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d2f460b0dbab..9e5a533a1622 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1371,6 +1371,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1371 } 1371 }
1372 1372
1373 new_slave->dev = slave_dev; 1373 new_slave->dev = slave_dev;
1374 slave_dev->priv_flags |= IFF_BONDING;
1374 1375
1375 if ((bond->params.mode == BOND_MODE_TLB) || 1376 if ((bond->params.mode == BOND_MODE_TLB) ||
1376 (bond->params.mode == BOND_MODE_ALB)) { 1377 (bond->params.mode == BOND_MODE_ALB)) {
@@ -1784,7 +1785,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1784 dev_set_mac_address(slave_dev, &addr); 1785 dev_set_mac_address(slave_dev, &addr);
1785 1786
1786 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB | 1787 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
1787 IFF_SLAVE_INACTIVE); 1788 IFF_SLAVE_INACTIVE | IFF_BONDING);
1788 1789
1789 kfree(slave); 1790 kfree(slave);
1790 1791
@@ -3216,6 +3217,9 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
3216 (event_dev ? event_dev->name : "None"), 3217 (event_dev ? event_dev->name : "None"),
3217 event); 3218 event);
3218 3219
3220 if (!(event_dev->priv_flags & IFF_BONDING))
3221 return NOTIFY_DONE;
3222
3219 if (event_dev->flags & IFF_MASTER) { 3223 if (event_dev->flags & IFF_MASTER) {
3220 dprintk("IFF_MASTER\n"); 3224 dprintk("IFF_MASTER\n");
3221 return bond_master_netdev_event(event, event_dev); 3225 return bond_master_netdev_event(event, event_dev);
@@ -4185,6 +4189,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4185 /* Initialize the device options */ 4189 /* Initialize the device options */
4186 bond_dev->tx_queue_len = 0; 4190 bond_dev->tx_queue_len = 0;
4187 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; 4191 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
4192 bond_dev->priv_flags |= IFF_BONDING;
4188 4193
4189 /* At first, we block adding VLANs. That's the only way to 4194 /* At first, we block adding VLANs. That's the only way to
4190 * prevent problems that occur when adding VLANs over an 4195 * prevent problems that occur when adding VLANs over an