]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
bridge: start hello_timer when enabling KERNEL_STP in br_stp_start
authorXin Long <lucien.xin@gmail.com>
Fri, 19 May 2017 14:20:29 +0000 (22:20 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 21 May 2017 17:33:28 +0000 (13:33 -0400)
Since commit 76b91c32dd86 ("bridge: stp: when using userspace stp stop
kernel hello and hold timers"), bridge would not start hello_timer if
stp_enabled is not KERNEL_STP when br_dev_open.

The problem is even if users set stp_enabled with KERNEL_STP later,
the timer will still not be started. It causes that KERNEL_STP can
not really work. Users have to re-ifup the bridge to avoid this.

This patch is to fix it by starting br->hello_timer when enabling
KERNEL_STP in br_stp_start.

As an improvement, it's also to start hello_timer again only when
br->stp_enabled is KERNEL_STP in br_hello_timer_expired, there is
no reason to start the timer again when it's NO_STP.

Fixes: 76b91c32dd86 ("bridge: stp: when using userspace stp stop kernel hello and hold timers")
Reported-by: Haidong Li <haili@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Ivan Vecera <cera@cera.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_stp_if.c
net/bridge/br_stp_timer.c

index 08341d2aa9c946d7bdd6e0d599e31ba96557a290..0db8102995a506d64ece0de48b7266ccf3839ba8 100644 (file)
@@ -179,6 +179,7 @@ static void br_stp_start(struct net_bridge *br)
                br_debug(br, "using kernel STP\n");
 
                /* To start timers on any ports left in blocking */
+               mod_timer(&br->hello_timer, jiffies + br->hello_time);
                br_port_state_selection(br);
        }
 
index c98b3e5c140a5f30a28fd748408cf5e949a032b6..60b6fe277a8b0c90faad0dfcda87f149ceaa5552 100644 (file)
@@ -40,7 +40,7 @@ static void br_hello_timer_expired(unsigned long arg)
        if (br->dev->flags & IFF_UP) {
                br_config_bpdu_generation(br);
 
-               if (br->stp_enabled != BR_USER_STP)
+               if (br->stp_enabled == BR_KERNEL_STP)
                        mod_timer(&br->hello_timer,
                                  round_jiffies(jiffies + br->hello_time));
        }