bug in MAC bridge (br.c)

Robert Pintarelli (loki@sol.wohnheim.uni-ulm.de)
Mon, 2 Aug 1999 13:46:25 +0000


hi,

the MAC bridge handles the bdpu timeout values wrong.
due to ieee 802.1d (9.2.8 page 130) these values are 1/256 of a second.
problems occur if there are bridges that handle these values correct
the timeout delays are interpreted 256 times as long as they are, i.e.
3840 sec forward delay instead of 15.
the other bridge also may get confused, because the linux bridge always
gives timouts values of 0.

this small patch fixes the problem:

---- cut here ----

diff -u --recursive linux-2.2.10/net/bridge/br.c linux/net/bridge/br.c
--- linux-2.2.10/net/bridge/br.c Sun Aug 1 16:25:00 1999
+++ linux/net/bridge/br.c Sun Aug 1 16:36:05 1999
@@ -39,6 +39,8 @@
* Alan Cox: Merged Jean-Rene's stuff, reformatted stuff a bit
* so blame me first if its broken ;)
*
+ * Robert Pintarelli: fixed bug in bpdu time values
+ *
* Todo:
* Don't bring up devices automatically. Start ports disabled
* and use a netlink notifier so a daemon can maintain the bridge
@@ -284,13 +286,13 @@
config_bpdu.message_age = Zero; /* (4.6.1.3.2(5)) */
} else {
config_bpdu.message_age
- = message_age_timer[bridge_info.root_port].value
- + Message_age_increment; /* (4.6.1.3.2(6)) */
+ = (message_age_timer[bridge_info.root_port].value
+ + Message_age_increment) << 8; /* (4.6.1.3.2(6)) */
}

- config_bpdu.max_age = bridge_info.max_age;/* (4.6.1.3.2(7)) */
- config_bpdu.hello_time = bridge_info.hello_time;
- config_bpdu.forward_delay = bridge_info.forward_delay;
+ config_bpdu.max_age = bridge_info.max_age << 8;/* (4.6.1.3.2(7)) */
+ config_bpdu.hello_time = bridge_info.hello_time << 8;
+ config_bpdu.forward_delay = bridge_info.forward_delay << 8;
config_bpdu.top_change_ack =
port_info[port_no].top_change_ack;
/* (4.6.1.3.2(8)) */
@@ -363,10 +365,10 @@

static void record_config_timeout_values(Config_bpdu *config) /* (4.6.3) */
{
- bridge_info.max_age = config->max_age; /* (4.6.3.3) */
- bridge_info.hello_time = config->hello_time;
- bridge_info.forward_delay = config->forward_delay;
- bridge_info.top_change = config->top_change;
+ bridge_info.max_age = config->max_age >> 8; /* (4.6.3.3) */
+ bridge_info.hello_time = config->hello_time >> 8;
+ bridge_info.forward_delay = config->forward_delay >> 8;
+ bridge_info.top_change = config->top_change >> 8;
}

static void config_bpdu_generation(void)

---- cut here ----

greets
robert

-- 
in a world without fences, who needs gates?

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/