diff options
-rw-r--r-- | net/bridge/br_if.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 7fa3a5a9971f..8b38c839d539 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -81,26 +81,27 @@ static void port_carrier_check(void *arg) | |||
81 | { | 81 | { |
82 | struct net_device *dev = arg; | 82 | struct net_device *dev = arg; |
83 | struct net_bridge_port *p; | 83 | struct net_bridge_port *p; |
84 | struct net_bridge *br; | ||
84 | 85 | ||
85 | rtnl_lock(); | 86 | rtnl_lock(); |
86 | p = dev->br_port; | 87 | p = dev->br_port; |
87 | if (!p) | 88 | if (!p) |
88 | goto done; | 89 | goto done; |
89 | 90 | br = p->br; | |
90 | if (netif_carrier_ok(p->dev)) { | 91 | |
91 | u32 cost = port_cost(p->dev); | 92 | if (netif_carrier_ok(dev)) |
92 | 93 | p->path_cost = port_cost(dev); | |
93 | spin_lock_bh(&p->br->lock); | 94 | |
94 | if (p->state == BR_STATE_DISABLED) { | 95 | if (br->dev->flags & IFF_UP) { |
95 | p->path_cost = cost; | 96 | spin_lock_bh(&br->lock); |
96 | br_stp_enable_port(p); | 97 | if (netif_carrier_ok(dev)) { |
98 | if (p->state == BR_STATE_DISABLED) | ||
99 | br_stp_enable_port(p); | ||
100 | } else { | ||
101 | if (p->state != BR_STATE_DISABLED) | ||
102 | br_stp_disable_port(p); | ||
97 | } | 103 | } |
98 | spin_unlock_bh(&p->br->lock); | 104 | spin_unlock_bh(&br->lock); |
99 | } else { | ||
100 | spin_lock_bh(&p->br->lock); | ||
101 | if (p->state != BR_STATE_DISABLED) | ||
102 | br_stp_disable_port(p); | ||
103 | spin_unlock_bh(&p->br->lock); | ||
104 | } | 105 | } |
105 | done: | 106 | done: |
106 | rtnl_unlock(); | 107 | rtnl_unlock(); |