Skip to contentSkip to conversation

bridge: Correctly clamp MAX forward_delay when enabling STP

PATCH In review Vlad Yasevich 4 participants 4 messages Oct 15, 2013 – Oct 17, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bridge: Correctly clamp MAX forward_delay when enabling STP

Commit be4f154d5ef0ca147ab6bcd38857a774133f5450
bridge: Clamp forward_delay when enabling STP
had a typo when attempting to clamp maximum forward delay.

It is possible to set bridge_forward_delay to be higher then permitted maximum when STP is off. When turning STP on, the higher then allowed delay has to be clamed down to max value.

CC Herbert Xu <[email protected]>
CC Stephen Hemminger <[email protected]>
---
 net/bridge/br_stp_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_stp_if.c +1 -1
index 108084a..656a6f3 100644
@@ -134,7 +134,7 @@ static void br_stp_start(struct net_bridge *br)
 
 	if (br->bridge_forward_delay < BR_MIN_FORWARD_DELAY)
 		__br_set_forward_delay(br, BR_MIN_FORWARD_DELAY);
-	else if (br->bridge_forward_delay < BR_MAX_FORWARD_DELAY)
+	else if (br->bridge_forward_delay > BR_MAX_FORWARD_DELAY)
 		__br_set_forward_delay(br, BR_MAX_FORWARD_DELAY);
 
 	if (r == 0) {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Vlad Yasevich

Commit be4f154d5ef0ca147ab6bcd38857a774133f5450
bridge: Clamp forward_delay when enabling STP
had a typo when attempting to clamp maximum forward delay.

It is possible to set bridge_forward_delay to be higher then permitted maximum when STP is off. When turning STP on, the higher then allowed delay has to be clamed down to max value.

CC Herbert Xu <[email protected]>
CC Stephen Hemminger <[email protected]>

I think it should also be queued for stable, as it's present there also. David, mind adding it?

As for the code - great catch!

Quoted 24 lines

---
net/bridge/br_stp_if.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_stp_if.c +1 -1
index 108084a..656a6f3 100644
@@ -134,7 +134,7 @@ static void br_stp_start(struct net_bridge *br)
 
 	if (br->bridge_forward_delay < BR_MIN_FORWARD_DELAY)
 		__br_set_forward_delay(br, BR_MIN_FORWARD_DELAY);
-	else if (br->bridge_forward_delay < BR_MAX_FORWARD_DELAY)
+	else if (br->bridge_forward_delay > BR_MAX_FORWARD_DELAY)
 		__br_set_forward_delay(br, BR_MAX_FORWARD_DELAY);
 
 	if (r == 0) {
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v1 1/1
#2 lore raw
In reply to Vlad Yasevich
Quoted 11 lines · Vlad Yasevich

Commit be4f154d5ef0ca147ab6bcd38857a774133f5450
bridge: Clamp forward_delay when enabling STP
had a typo when attempting to clamp maximum forward delay.

It is possible to set bridge_forward_delay to be higher then permitted maximum when STP is off. When turning STP on, the higher then allowed delay has to be clamed down to max value.

CC Herbert Xu <[email protected]>
CC Stephen Hemminger <[email protected]>

Good catch!

Thanks,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#3 lore raw

From: Herbert Xu <[email protected]>
Date: Wed, 16 Oct 2013 08:56:57 +0800

Quoted 9 lines · Vlad Yasevich
Quoted 8 lines

Commit be4f154d5ef0ca147ab6bcd38857a774133f5450
bridge: Clamp forward_delay when enabling STP
had a typo when attempting to clamp maximum forward delay.

It is possible to set bridge_forward_delay to be higher then permitted maximum when STP is off. When turning STP on, the higher then allowed delay has to be clamed down to max value.

Quoted 7 lines
Quoted 3 lines
CC Herbert Xu <[email protected]>
CC Stephen Hemminger <[email protected]>

Good catch!

Applied and queued up for -stable, thanks.