All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH 2.6] bridge -- rmmod device while bridge is down fails
@ 2004-08-03 20:07 Stephen Hemminger
  2004-08-04 16:58 ` [Bridge] " David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2004-08-03 20:07 UTC (permalink / raw)
  To: David S. Miller; +Cc: bridge

The changes to bridge notifier to handle link state changes introduced
a bug. The case of device unregistering while bridge is down was no
longer being handled. Add comment so maintainer doesn't forget.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
 
diff -Nru a/net/bridge/br_notify.c b/net/bridge/br_notify.c
--- a/net/bridge/br_notify.c	2004-08-03 13:06:30 -07:00
+++ b/net/bridge/br_notify.c	2004-08-03 13:06:30 -07:00
@@ -23,32 +23,39 @@
 	.notifier_call = br_device_event
 };
 
+/*
+ * Handle changes in state of network devices enslaved to a bridge.
+ * 
+ * Note: don't care about up/down if bridge itself is down, because
+ *     port state is checked when bridge is brought up.
+ */
 static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr)
 {
 	struct net_device *dev = ptr;
 	struct net_bridge_port *p = dev->br_port;
 	struct net_bridge *br;
 
+	/* not a port of a bridge */
 	if (p == NULL)
 		return NOTIFY_DONE;
 
 	br = p->br;
-	if ( !(br->dev->flags & IFF_UP))
-		return NOTIFY_DONE;
-
-	if (event == NETDEV_CHANGEMTU) {
-		dev_set_mtu(br->dev, br_min_mtu(br));
-		return NOTIFY_DONE;
-	}
 
 	spin_lock_bh(&br->lock);
 	switch (event) {
+	case NETDEV_CHANGEMTU:
+		dev_set_mtu(br->dev, br_min_mtu(br));
+		break;
+
 	case NETDEV_CHANGEADDR:
 		br_fdb_changeaddr(p, dev->dev_addr);
 		br_stp_recalculate_bridge_id(br);
 		break;
 
 	case NETDEV_CHANGE:	/* device is up but carrier changed */
+		if (!(br->dev->flags & IFF_UP))
+			break;
+
 		if (netif_carrier_ok(dev)) {
 			if (p->state == BR_STATE_DISABLED)
 				br_stp_enable_port(p);
@@ -59,11 +66,12 @@
 		break;
 
 	case NETDEV_DOWN:
-		br_stp_disable_port(p);
+		if (br->dev->flags & IFF_UP)
+			br_stp_disable_port(p);
 		break;
 
 	case NETDEV_UP:
-		if (netif_carrier_ok(dev)) 
+		if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) 
 			br_stp_enable_port(p);
 		break;
 

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

* [Bridge] Re: [PATCH 2.6] bridge -- rmmod device while bridge is down fails
  2004-08-03 20:07 [Bridge] [PATCH 2.6] bridge -- rmmod device while bridge is down fails Stephen Hemminger
@ 2004-08-04 16:58 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-08-04 16:58 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: bridge

On Tue, 3 Aug 2004 13:07:03 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> The changes to bridge notifier to handle link state changes introduced
> a bug. The case of device unregistering while bridge is down was no
> longer being handled. Add comment so maintainer doesn't forget.

Looks good, applied.

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

end of thread, other threads:[~2004-08-04 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-03 20:07 [Bridge] [PATCH 2.6] bridge -- rmmod device while bridge is down fails Stephen Hemminger
2004-08-04 16:58 ` [Bridge] " David S. Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.