public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH 6/7] bonding: Add priv_flag to avoid event mishandling
@ 2006-09-01 22:13 Jay Vosburgh
  2006-09-04  8:12 ` Pawel Foremski
  0 siblings, 1 reply; 2+ messages in thread
From: Jay Vosburgh @ 2006-09-01 22:13 UTC (permalink / raw)
  To: netdev, bonding-devel; +Cc: Jeff Garzik


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>

--- netdev-2.6.git-upstream/include/linux/if.h	2006/08/26 17:23:42	1.1
+++ netdev-2.6.git-upstream/include/linux/if.h	2006/08/26 17:24:23	1.2
@@ -59,6 +59,7 @@
 #define IFF_SLAVE_INACTIVE	0x4	/* bonding slave not the curr. active */
 #define IFF_MASTER_8023AD	0x8	/* bonding master, 802.3ad. 	*/
 #define IFF_MASTER_ALB	0x10		/* bonding master, balance-alb.	*/
+#define IFF_BONDING	0x20		/* bonding master or slave	*/
 
 #define IF_GET_IFACE	0x0001		/* for querying only */
 #define IF_GET_PROTO	0x0002
--- netdev-2.6.git-upstream/drivers/net/bonding/bond_main.c	2006/08/19 15:47:27	1.4
+++ netdev-2.6.git-upstream/drivers/net/bonding/bond_main.c	2006/08/26 17:24:41	1.5
@@ -1371,6 +1371,7 @@ int bond_enslave(struct net_device *bond
 	}
 
 	new_slave->dev = slave_dev;
+	slave_dev->priv_flags |= IFF_BONDING;
 
 	if ((bond->params.mode == BOND_MODE_TLB) ||
 	    (bond->params.mode == BOND_MODE_ALB)) {
@@ -1784,7 +1785,7 @@ int bond_release(struct net_device *bond
 	dev_set_mac_address(slave_dev, &addr);
 
 	slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
-				   IFF_SLAVE_INACTIVE);
+				   IFF_SLAVE_INACTIVE | IFF_BONDING);
 
 	kfree(slave);
 
@@ -3216,6 +3217,9 @@ static int bond_netdev_event(struct noti
 		(event_dev ? event_dev->name : "None"),
 		event);
 
+	if (!(event_dev->priv_flags & IFF_BONDING))
+		return NOTIFY_DONE;
+
 	if (event_dev->flags & IFF_MASTER) {
 		dprintk("IFF_MASTER\n");
 		return bond_master_netdev_event(event, event_dev);
@@ -4185,6 +4189,7 @@ static int bond_init(struct net_device *
 	/* Initialize the device options */
 	bond_dev->tx_queue_len = 0;
 	bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
+	bond_dev->priv_flags |= IFF_BONDING;
 
 	/* At first, we block adding VLANs. That's the only way to
 	 * prevent problems that occur when adding VLANs over an

-- 
VGER BF report: U 0.499999

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-04  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-01 22:13 [PATCH 6/7] bonding: Add priv_flag to avoid event mishandling Jay Vosburgh
2006-09-04  8:12 ` Pawel Foremski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox