diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-03-22 17:08:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:48 -0400 |
commit | b86c45035c439cfa6ef5b2e4bf080b24bd8765f1 (patch) | |
tree | b77fee73c5c5536eef58ae5c8366f7bbe8cacf31 /net/bridge | |
parent | 9cde070874b822d4677f4f01fe146991785813b1 (diff) |
bridge: change when netlink events go to STP
Need to tell STP daemon about more events, like any time a
device is added even when it is down.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_if.c | 4 | ||||
-rw-r--r-- | net/bridge/br_notify.c | 13 | ||||
-rw-r--r-- | net/bridge/br_stp_if.c | 3 |
3 files changed, 13 insertions, 7 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index cf10b8f2a1c7..690573bbf012 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -152,6 +152,8 @@ static void del_nbp(struct net_bridge_port *p) | |||
152 | br_stp_disable_port(p); | 152 | br_stp_disable_port(p); |
153 | spin_unlock_bh(&br->lock); | 153 | spin_unlock_bh(&br->lock); |
154 | 154 | ||
155 | br_ifinfo_notify(RTM_DELLINK, p); | ||
156 | |||
155 | br_fdb_delete_by_port(br, p, 1); | 157 | br_fdb_delete_by_port(br, p, 1); |
156 | 158 | ||
157 | list_del_rcu(&p->list); | 159 | list_del_rcu(&p->list); |
@@ -434,6 +436,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
434 | br_stp_enable_port(p); | 436 | br_stp_enable_port(p); |
435 | spin_unlock_bh(&br->lock); | 437 | spin_unlock_bh(&br->lock); |
436 | 438 | ||
439 | br_ifinfo_notify(RTM_NEWLINK, p); | ||
440 | |||
437 | dev_set_mtu(br->dev, br_min_mtu(br)); | 441 | dev_set_mtu(br->dev, br_min_mtu(br)); |
438 | 442 | ||
439 | kobject_uevent(&p->kobj, KOBJ_ADD); | 443 | kobject_uevent(&p->kobj, KOBJ_ADD); |
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index 37357ed2149b..c8451d3a070c 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c | |||
@@ -50,7 +50,6 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v | |||
50 | case NETDEV_CHANGEADDR: | 50 | case NETDEV_CHANGEADDR: |
51 | spin_lock_bh(&br->lock); | 51 | spin_lock_bh(&br->lock); |
52 | br_fdb_changeaddr(p, dev->dev_addr); | 52 | br_fdb_changeaddr(p, dev->dev_addr); |
53 | br_ifinfo_notify(RTM_NEWLINK, p); | ||
54 | br_stp_recalculate_bridge_id(br); | 53 | br_stp_recalculate_bridge_id(br); |
55 | spin_unlock_bh(&br->lock); | 54 | spin_unlock_bh(&br->lock); |
56 | break; | 55 | break; |
@@ -74,10 +73,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v | |||
74 | break; | 73 | break; |
75 | 74 | ||
76 | case NETDEV_UP: | 75 | case NETDEV_UP: |
77 | spin_lock_bh(&br->lock); | 76 | if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) { |
78 | if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) | 77 | spin_lock_bh(&br->lock); |
79 | br_stp_enable_port(p); | 78 | br_stp_enable_port(p); |
80 | spin_unlock_bh(&br->lock); | 79 | spin_unlock_bh(&br->lock); |
80 | } | ||
81 | break; | 81 | break; |
82 | 82 | ||
83 | case NETDEV_UNREGISTER: | 83 | case NETDEV_UNREGISTER: |
@@ -85,5 +85,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v | |||
85 | break; | 85 | break; |
86 | } | 86 | } |
87 | 87 | ||
88 | /* Events that may cause spanning tree to refresh */ | ||
89 | if (event == NETDEV_CHANGEADDR || event == NETDEV_UP || | ||
90 | event == NETDEV_CHANGE || event == NETDEV_DOWN) | ||
91 | br_ifinfo_notify(RTM_NEWLINK, p); | ||
92 | |||
88 | return NOTIFY_DONE; | 93 | return NOTIFY_DONE; |
89 | } | 94 | } |
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 1c1806d7c489..3e246b37020e 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c | |||
@@ -87,7 +87,6 @@ void br_stp_disable_bridge(struct net_bridge *br) | |||
87 | void br_stp_enable_port(struct net_bridge_port *p) | 87 | void br_stp_enable_port(struct net_bridge_port *p) |
88 | { | 88 | { |
89 | br_init_port(p); | 89 | br_init_port(p); |
90 | br_ifinfo_notify(RTM_NEWLINK, p); | ||
91 | br_port_state_selection(p->br); | 90 | br_port_state_selection(p->br); |
92 | } | 91 | } |
93 | 92 | ||
@@ -101,8 +100,6 @@ void br_stp_disable_port(struct net_bridge_port *p) | |||
101 | printk(KERN_INFO "%s: port %i(%s) entering %s state\n", | 100 | printk(KERN_INFO "%s: port %i(%s) entering %s state\n", |
102 | br->dev->name, p->port_no, p->dev->name, "disabled"); | 101 | br->dev->name, p->port_no, p->dev->name, "disabled"); |
103 | 102 | ||
104 | br_ifinfo_notify(RTM_DELLINK, p); | ||
105 | |||
106 | wasroot = br_is_root_bridge(br); | 103 | wasroot = br_is_root_bridge(br); |
107 | br_become_designated_port(p); | 104 | br_become_designated_port(p); |
108 | p->state = BR_STATE_DISABLED; | 105 | p->state = BR_STATE_DISABLED; |