Skip to content

Commit 3a85421

Browse files
lxingregkh
authored andcommitted
bridge: start hello_timer when enabling KERNEL_STP in br_stp_start
[ Upstream commit 6d18c732b95c0a9d35e9f978b4438bba15412284 ] Since commit 76b91c3 ("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: 76b91c3 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b543ccc commit 3a85421

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

net/bridge/br_stp_if.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ static void br_stp_start(struct net_bridge *br)
166166
br_debug(br, "using kernel STP\n");
167167

168168
/* To start timers on any ports left in blocking */
169+
mod_timer(&br->hello_timer, jiffies + br->hello_time);
169170
br_port_state_selection(br);
170171
}
171172

net/bridge/br_stp_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void br_hello_timer_expired(unsigned long arg)
4040
if (br->dev->flags & IFF_UP) {
4141
br_config_bpdu_generation(br);
4242

43-
if (br->stp_enabled != BR_USER_STP)
43+
if (br->stp_enabled == BR_KERNEL_STP)
4444
mod_timer(&br->hello_timer,
4545
round_jiffies(jiffies + br->hello_time));
4646
}

0 commit comments

Comments
 (0)