Skip to content

Commit

Permalink
bridge: fix hello and hold timers starting/stopping
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ivan Vecera authored and David S. Miller committed May 22, 2017
1 parent 85deed5 commit bd08048
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions net/bridge/br_stp_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static int br_stp_call_user(struct net_bridge *br, char *arg)

static void br_stp_start(struct net_bridge *br)
{
struct net_bridge_port *p;
int err = -ENOENT;

if (net_eq(dev_net(br->dev), &init_net))
Expand All @@ -169,11 +168,6 @@ static void br_stp_start(struct net_bridge *br)
if (!err) {
br->stp_enabled = BR_USER_STP;
br_debug(br, "userspace STP started\n");

/* Stop hello and hold timers */
del_timer(&br->hello_timer);
list_for_each_entry(p, &br->port_list, list)
del_timer(&p->hold_timer);
} else {
br->stp_enabled = BR_KERNEL_STP;
br_debug(br, "using kernel STP\n");
Expand All @@ -187,7 +181,6 @@ static void br_stp_start(struct net_bridge *br)

static void br_stp_stop(struct net_bridge *br)
{
struct net_bridge_port *p;
int err;

if (br->stp_enabled == BR_USER_STP) {
Expand All @@ -196,10 +189,6 @@ static void br_stp_stop(struct net_bridge *br)
br_err(br, "failed to stop userspace STP (%d)\n", err);

/* To start timers on any ports left in blocking */
mod_timer(&br->hello_timer, jiffies + br->hello_time);
list_for_each_entry(p, &br->port_list, list)
mod_timer(&p->hold_timer,
round_jiffies(jiffies + BR_HOLD_TIME));
spin_lock_bh(&br->lock);
br_port_state_selection(br);
spin_unlock_bh(&br->lock);
Expand Down

0 comments on commit bd08048

Please sign in to comment.