Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c03150e authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller
Browse files

bridge: send proper message_age in config BPDU

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 781223a1
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -124,6 +124,7 @@ struct net_bridge_port
	bridge_id			designated_bridge;
	bridge_id			designated_bridge;
	u32				path_cost;
	u32				path_cost;
	u32				designated_cost;
	u32				designated_cost;
	unsigned long			designated_age;


	struct timer_list		forward_delay_timer;
	struct timer_list		forward_delay_timer;
	struct timer_list		hold_timer;
	struct timer_list		hold_timer;
+2 −2
Original line number Original line Diff line number Diff line
@@ -164,8 +164,7 @@ void br_transmit_config(struct net_bridge_port *p)
	else {
	else {
		struct net_bridge_port *root
		struct net_bridge_port *root
			= br_get_port(br, br->root_port);
			= br_get_port(br, br->root_port);
		bpdu.message_age = br->max_age
		bpdu.message_age = (jiffies - root->designated_age)
			- (root->message_age_timer.expires - jiffies)
			+ MESSAGE_AGE_INCR;
			+ MESSAGE_AGE_INCR;
	}
	}
	bpdu.max_age = br->max_age;
	bpdu.max_age = br->max_age;
@@ -189,6 +188,7 @@ static inline void br_record_config_information(struct net_bridge_port *p,
	p->designated_cost = bpdu->root_path_cost;
	p->designated_cost = bpdu->root_path_cost;
	p->designated_bridge = bpdu->bridge_id;
	p->designated_bridge = bpdu->bridge_id;
	p->designated_port = bpdu->port_id;
	p->designated_port = bpdu->port_id;
	p->designated_age = jiffies + bpdu->message_age;


	mod_timer(&p->message_age_timer, jiffies
	mod_timer(&p->message_age_timer, jiffies
		  + (p->br->max_age - bpdu->message_age));
		  + (p->br->max_age - bpdu->message_age));