patch-2.4.27 linux-2.4.27/net/bridge/br_stp.c
Next file: linux-2.4.27/net/core/Makefile
Previous file: linux-2.4.27/net/bridge/br_private.h
Back to the patch index
Back to the overall index
- Lines: 48
- Date:
2004-08-07 16:26:06.822435861 -0700
- Orig file:
linux-2.4.26/net/bridge/br_stp.c
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.26/net/bridge/br_stp.c linux-2.4.27/net/bridge/br_stp.c
@@ -20,7 +20,10 @@
#include "br_private.h"
#include "br_private_stp.h"
-
+/* since time values in bpdu are in jiffies and then scaled (1/256)
+ * before sending, make sure that is at least one.
+ */
+#define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256))
/* called under ioctl_lock or bridge lock */
int br_is_root_bridge(struct net_bridge *br)
@@ -160,24 +163,26 @@
bpdu.root_path_cost = br->root_path_cost;
bpdu.bridge_id = br->bridge_id;
bpdu.port_id = p->port_id;
- bpdu.message_age = 0;
- if (!br_is_root_bridge(br)) {
+ if (br_is_root_bridge(br))
+ bpdu.message_age = 0;
+ else {
struct net_bridge_port *root;
- unsigned long age;
root = br_get_port(br, br->root_port);
- age = br_timer_get_residue(&root->message_age_timer) + 1;
- bpdu.message_age = age;
+ bpdu.message_age = br_timer_get_residue(&root->message_age_timer)
+ + MESSAGE_AGE_INCR;
}
bpdu.max_age = br->max_age;
bpdu.hello_time = br->hello_time;
bpdu.forward_delay = br->forward_delay;
- br_send_config_bpdu(p, &bpdu);
+ if (bpdu.message_age < br->max_age) {
+ br_send_config_bpdu(p, &bpdu);
- p->topology_change_ack = 0;
- p->config_pending = 0;
- br_timer_set(&p->hold_timer, jiffies);
+ p->topology_change_ack = 0;
+ p->config_pending = 0;
+ br_timer_set(&p->hold_timer, jiffies);
+ }
}
/* called under bridge lock */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)