Commit 576eb62598f10c8c7fd75703fe89010cdcfff596
Committed by
David S. Miller
1 parent
aa1113d9f8
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
bridge: respect RFC2863 operational state
The bridge link detection should follow the operational state of the lower device, rather than the carrier bit. This allows devices like tunnels that are controlled by userspace control plane to work with bridge STP link management. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Reviewed-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 4 changed files with 9 additions and 6 deletions Side-by-side Diff
net/bridge/br_if.c
... | ... | @@ -66,14 +66,14 @@ |
66 | 66 | struct net_device *dev = p->dev; |
67 | 67 | struct net_bridge *br = p->br; |
68 | 68 | |
69 | - if (netif_running(dev) && netif_carrier_ok(dev)) | |
69 | + if (netif_running(dev) && netif_oper_up(dev)) | |
70 | 70 | p->path_cost = port_cost(dev); |
71 | 71 | |
72 | 72 | if (!netif_running(br->dev)) |
73 | 73 | return; |
74 | 74 | |
75 | 75 | spin_lock_bh(&br->lock); |
76 | - if (netif_running(dev) && netif_carrier_ok(dev)) { | |
76 | + if (netif_running(dev) && netif_oper_up(dev)) { | |
77 | 77 | if (p->state == BR_STATE_DISABLED) |
78 | 78 | br_stp_enable_port(p); |
79 | 79 | } else { |
... | ... | @@ -383,7 +383,7 @@ |
383 | 383 | spin_lock_bh(&br->lock); |
384 | 384 | changed_addr = br_stp_recalculate_bridge_id(br); |
385 | 385 | |
386 | - if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) && | |
386 | + if (netif_running(dev) && netif_oper_up(dev) && | |
387 | 387 | (br->dev->flags & IFF_UP)) |
388 | 388 | br_stp_enable_port(p); |
389 | 389 | spin_unlock_bh(&br->lock); |
net/bridge/br_netlink.c
... | ... | @@ -181,8 +181,11 @@ |
181 | 181 | if (p->br->stp_enabled == BR_KERNEL_STP) |
182 | 182 | return -EBUSY; |
183 | 183 | |
184 | + /* if device is not up, change is not allowed | |
185 | + * if link is not present, only allowable state is disabled | |
186 | + */ | |
184 | 187 | if (!netif_running(p->dev) || |
185 | - (!netif_carrier_ok(p->dev) && state != BR_STATE_DISABLED)) | |
188 | + (!netif_oper_up(p->dev) && state != BR_STATE_DISABLED)) | |
186 | 189 | return -ENETDOWN; |
187 | 190 | |
188 | 191 | p->state = state; |
net/bridge/br_notify.c
net/bridge/br_stp_if.c