Vitalii Demianets
2011-Dec-13 09:36 UTC
[Bridge] [PATCH] bridge: push blocking slaves to forwarding when turning stp off
If there is a slave in blocking state when stp is turned off, that slave will remain in blocking state for indefinitely long time until interface state changed. We should push all blocking slaves into forwarding state after turning stp off. Signed-off-by: Vitalii Demianets <vitas at nppfactor.kiev.ua> --- net/bridge/br_stp.c | 5 ++++- net/bridge/br_stp_if.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index dd147d7..aed7e21 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c @@ -415,7 +415,10 @@ void br_port_state_selection(struct net_bridge *br) } else { p->config_pending = 0; p->topology_change_ack = 0; - br_make_blocking(p); + if(br->stp_enabled == BR_NO_STP) + br_make_forwarding(p); + else + br_make_blocking(p); } } diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 19308e3..38d8dd7 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c @@ -153,14 +153,14 @@ static void br_stp_stop(struct net_bridge *br) if (br->stp_enabled == BR_USER_STP) { r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); br_info(br, "userspace STP stopped, return code %d\n", r); - - /* To start timers on any ports left in blocking */ - spin_lock_bh(&br->lock); - br_port_state_selection(br); - spin_unlock_bh(&br->lock); } br->stp_enabled = BR_NO_STP; + + /* To push in forwarding state any ports left in blocking */ + spin_lock_bh(&br->lock); + br_port_state_selection(br); + spin_unlock_bh(&br->lock); } void br_stp_set_enabled(struct net_bridge *br, unsigned long val) -- 1.7.3.4
Stephen Hemminger
2011-Dec-14 00:16 UTC
[Bridge] [PATCH] bridge: push blocking slaves to forwarding when turning stp off
On Tue, 13 Dec 2011 11:36:25 +0200 Vitalii Demianets <vitas at nppfactor.kiev.ua> wrote:> If there is a slave in blocking state when stp is turned off, that slave will > remain in blocking state for indefinitely long time until interface state > changed. We should push all blocking slaves into forwarding state after > turning stp off. > > Signed-off-by: Vitalii Demianets <vitas at nppfactor.kiev.ua>Maybe. But if the port was in the blocking state then STP must have decided there was a loop in the network if that port was used. Therefore blindly putting the port into forwarding state could cause disastrous network flood. The user can force the port back out of blocking state (via sysfs).