summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Vecera <cera@cera.cz>2017-05-19 13:30:43 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-22 14:40:22 -0400
commitbd080488a6cfd37135becedfdc87643b139c2345 (patch)
treeb3ec5d73cf9895423e5e75cd7985821d0c0a65be
parent85deed56032b6c98b541895bfda9bdd74f6ed987 (diff)
bridge: fix hello and hold timers starting/stopping
Current bridge code incorrectly handles starting/stopping of hello and hold timers during STP enable/disable. 1. Timers are stopped in br_stp_start() during NO_STP->USER_STP transition. The timers are already stopped in NO_STP state so this is confusing no-op. 2. During USER_STP->NO_STP transition the timers are started. This does not make sense and is confusion because the timer should not be active in NO_STP state. Cc: davem@davemloft.net Cc: sashok@cumulusnetworks.com Cc: stephen@networkplumber.org Cc: bridge@lists.linux-foundation.org Cc: lucien.xin@gmail.com Cc: nikolay@cumulusnetworks.com Signed-off-by: Ivan Vecera <cera@cera.cz> Reviewed-by: Xin Long <lucien.xin@gmail.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/bridge/br_stp_if.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 08341d2aa9c9..a05027027513 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -150,7 +150,6 @@ static int br_stp_call_user(struct net_bridge *br, char *arg)
150 150
151static void br_stp_start(struct net_bridge *br) 151static void br_stp_start(struct net_bridge *br)
152{ 152{
153 struct net_bridge_port *p;
154 int err = -ENOENT; 153 int err = -ENOENT;
155 154
156 if (net_eq(dev_net(br->dev), &init_net)) 155 if (net_eq(dev_net(br->dev), &init_net))
@@ -169,11 +168,6 @@ static void br_stp_start(struct net_bridge *br)
169 if (!err) { 168 if (!err) {
170 br->stp_enabled = BR_USER_STP; 169 br->stp_enabled = BR_USER_STP;
171 br_debug(br, "userspace STP started\n"); 170 br_debug(br, "userspace STP started\n");
172
173 /* Stop hello and hold timers */
174 del_timer(&br->hello_timer);
175 list_for_each_entry(p, &br->port_list, list)
176 del_timer(&p->hold_timer);
177 } else { 171 } else {
178 br->stp_enabled = BR_KERNEL_STP; 172 br->stp_enabled = BR_KERNEL_STP;
179 br_debug(br, "using kernel STP\n"); 173 br_debug(br, "using kernel STP\n");
@@ -187,7 +181,6 @@ static void br_stp_start(struct net_bridge *br)
187 181
188static void br_stp_stop(struct net_bridge *br) 182static void br_stp_stop(struct net_bridge *br)
189{ 183{
190 struct net_bridge_port *p;
191 int err; 184 int err;
192 185
193 if (br->stp_enabled == BR_USER_STP) { 186 if (br->stp_enabled == BR_USER_STP) {
@@ -196,10 +189,6 @@ static void br_stp_stop(struct net_bridge *br)
196 br_err(br, "failed to stop userspace STP (%d)\n", err); 189 br_err(br, "failed to stop userspace STP (%d)\n", err);
197 190
198 /* To start timers on any ports left in blocking */ 191 /* To start timers on any ports left in blocking */
199 mod_timer(&br->hello_timer, jiffies + br->hello_time);
200 list_for_each_entry(p, &br->port_list, list)
201 mod_timer(&p->hold_timer,
202 round_jiffies(jiffies + BR_HOLD_TIME));
203 spin_lock_bh(&br->lock); 192 spin_lock_bh(&br->lock);
204 br_port_state_selection(br); 193 br_port_state_selection(br);
205 spin_unlock_bh(&br->lock); 194 spin_unlock_bh(&br->lock);