Commit b03b6dd5 authored by Vitalii Demianets's avatar Vitalii Demianets Committed by David S. Miller

bridge: master device stuck in no-carrier state forever when in user-stp mode

When in user-stp mode, bridge master do not follow state of its slaves, so
after the following sequence of events it can stuck forever in no-carrier
state:
1) turn stp off
2) put all slaves down - master device will follow their state and also go in
no-carrier state
3) turn stp on with bridge-stp script returning 0 (go to the user-stp mode)
Now bridge master won't follow slaves' state and will never reach running
state.

This patch solves the problem by making user-stp and kernel-stp behavior
similar regarding master following slaves' states.
Signed-off-by: default avatarVitalii Demianets <vitas@nppfactor.kiev.ua>
Acked-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent efbc368d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <net/sock.h> #include <net/sock.h>
#include "br_private.h" #include "br_private.h"
#include "br_private_stp.h"
static inline size_t br_nlmsg_size(void) static inline size_t br_nlmsg_size(void)
{ {
...@@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
p->state = new_state; p->state = new_state;
br_log_state(p); br_log_state(p);
spin_lock_bh(&p->br->lock);
br_port_state_selection(p->br);
spin_unlock_bh(&p->br->lock);
br_ifinfo_notify(RTM_NEWLINK, p); br_ifinfo_notify(RTM_NEWLINK, p);
return 0; return 0;
......
...@@ -399,14 +399,12 @@ void br_port_state_selection(struct net_bridge *br) ...@@ -399,14 +399,12 @@ void br_port_state_selection(struct net_bridge *br)
struct net_bridge_port *p; struct net_bridge_port *p;
unsigned int liveports = 0; unsigned int liveports = 0;
/* Don't change port states if userspace is handling STP */
if (br->stp_enabled == BR_USER_STP)
return;
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {
if (p->state == BR_STATE_DISABLED) if (p->state == BR_STATE_DISABLED)
continue; continue;
/* Don't change port states if userspace is handling STP */
if (br->stp_enabled != BR_USER_STP) {
if (p->port_no == br->root_port) { if (p->port_no == br->root_port) {
p->config_pending = 0; p->config_pending = 0;
p->topology_change_ack = 0; p->topology_change_ack = 0;
...@@ -419,6 +417,7 @@ void br_port_state_selection(struct net_bridge *br) ...@@ -419,6 +417,7 @@ void br_port_state_selection(struct net_bridge *br)
p->topology_change_ack = 0; p->topology_change_ack = 0;
br_make_blocking(p); br_make_blocking(p);
} }
}
if (p->state == BR_STATE_FORWARDING) if (p->state == BR_STATE_FORWARDING)
++liveports; ++liveports;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment