public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davmeloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH 1/5] bridge: send proper message_age in config BPDU
Date: Fri, 22 Jul 2011 10:47:06 -0700	[thread overview]
Message-ID: <20110722174757.764377577@vyatta.com> (raw)
In-Reply-To: 20110722174705.144993799@vyatta.com

[-- Attachment #1: br-stp-bpdu-messageage.patch --]
[-- Type: text/plain, Size: 2443 bytes --]

A bridge topology with three systems:

      +------+  +------+
      | A(2) |--| B(1) |
      +------+  +------+
           \    /
          +------+
          | C(3) |
          +------+

What is supposed to happen:
 * bridge with the lowest ID is elected root (for example: B)
 * C detects that A->C is higher cost path and puts in blocking state

What happens. Bridge with lowest id (B) is elected correctly as
root and things start out fine initially. But then config BPDU
doesn't get transmitted from A -> C. Because of that 
the link from A-C is transistioned to the forwarding state.

The root cause of this is that the configuration messages
is generated with bogus message age, and dropped before
sending.

In the standardmessage_age is supposed to be:
  the time since the generation of the Configuration BPDU by
  the Root that instigated the generation of this Configuration BPDU.

Reimplement this by recording the timestamp (age + jiffies) when
recording config information. The old code incorrectly used the time
elapsed on the ageing timer which was incorrect.

See also:
  https://bugzilla.vyatta.com/show_bug.cgi?id=7164

Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>

---
Patch against net-next-2.6.
Obviously needs to go to stable and 3.0 if stil open.


--- a/net/bridge/br_private.h	2011-04-29 16:16:03.000000000 -0700
+++ b/net/bridge/br_private.h	2011-07-21 20:13:31.651989371 -0700
@@ -124,6 +124,7 @@ struct net_bridge_port
 	bridge_id			designated_bridge;
 	u32				path_cost;
 	u32				designated_cost;
+	unsigned long			designated_age;
 
 	struct timer_list		forward_delay_timer;
 	struct timer_list		hold_timer;
--- a/net/bridge/br_stp.c	2011-07-20 09:06:24.519997816 -0700
+++ b/net/bridge/br_stp.c	2011-07-21 20:13:31.651989371 -0700
@@ -164,8 +164,7 @@ void br_transmit_config(struct net_bridg
 	else {
 		struct net_bridge_port *root
 			= br_get_port(br, br->root_port);
-		bpdu.message_age = br->max_age
-			- (root->message_age_timer.expires - jiffies)
+		bpdu.message_age = (jiffies - root->designated_age)
 			+ MESSAGE_AGE_INCR;
 	}
 	bpdu.max_age = br->max_age;
@@ -189,6 +188,7 @@ static inline void br_record_config_info
 	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;
 
 	mod_timer(&p->message_age_timer, jiffies
 		  + (p->br->max_age - bpdu->message_age));



  reply	other threads:[~2011-07-22 17:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 17:47 [PATCH 0/5] bridge patchs Stephen Hemminger
2011-07-22 17:47 ` Stephen Hemminger [this message]
2011-07-22 17:47 ` [PATCH 2/5] bridge: ignore bogus STP config packets Stephen Hemminger
2011-07-22 17:47 ` [PATCH 3/5] bridge: notifier called with the wrong device Stephen Hemminger
2011-07-22 17:47 ` [PATCH 4/5] [PATCH] bridge: add notification over netlink when STP changes state Stephen Hemminger
2011-07-22 17:47 ` [PATCH 5/5] bridge: minor cleanups Stephen Hemminger
2011-07-23  0:15 ` [PATCH 0/5] bridge patchs David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110722174757.764377577@vyatta.com \
    --to=shemminger@vyatta$(echo .)com \
    --cc=davem@davmeloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox