Patchwork [2/2] bridge: message age needs to increase, not decrease.

login
register
mail settings
Submitter Joakim Tjernlund
Date March 1, 2012, 6:12 p.m.
Message ID <1330625539-10247-2-git-send-email-Joakim.Tjernlund@transmode.se>
Download mbox | patch
Permalink /patch/144087/
State Accepted
Delegated to: David Miller
Headers show

Comments

Joakim Tjernlund - March 1, 2012, 6:12 p.m.
commit bridge: send proper message_age in config BPDU
added this gem:
  bpdu.message_age = (jiffies - root->designated_age)
  p->designated_age = jiffies + bpdu->message_age;
Notice how bpdu->message_age is negated when reassigned to
bpdu.message_age. This causes message age to decrease breaking the
STP protocol.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---

The bridge list seems very slow so try netdev instead.

 net/bridge/br_stp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - March 5, 2012, 2:57 a.m.
From: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Date: Thu, 1 Mar 2012 19:12:19 +0100

> commit bridge: send proper message_age in config BPDU
> added this gem:
>   bpdu.message_age = (jiffies - root->designated_age)
>   p->designated_age = jiffies + bpdu->message_age;
> Notice how bpdu->message_age is negated when reassigned to
> bpdu.message_age. This causes message age to decrease breaking the
> STP protocol.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 9a8aebd..45331fe 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -188,7 +188,7 @@  static inline void br_record_config_information(struct net_bridge_port *p,
 	p->designated_cost = bpdu->root_path_cost;
 	p->designated_bridge = bpdu->bridge_id;
 	p->designated_port = bpdu->port_id;
-	p->designated_age = jiffies + bpdu->message_age;
+	p->designated_age = jiffies - bpdu->message_age;
 
 	mod_timer(&p->message_age_timer, jiffies
 		  + (p->br->max_age - bpdu->message_age));