summaryrefslogtreecommitdiff
path: root/bridge.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-08-24 17:16:05 +0200
committerFelix Fietkau <nbd@nbd.name>2021-08-24 17:16:06 +0200
commit454e9c33c90691d5bea12263f1801a7dc38c20b1 (patch)
tree154f2686e32113e53e4504f1a42a41ab5809406b /bridge.c
parent6519cf31e4b033fd4a03c031ad882166be84fa6d (diff)
downloadnetifd-454e9c33c90691d5bea12263f1801a7dc38c20b1.tar.gz
bridge: tune default stp parameters
The default forwarding delay 2 is broken and makes STP non-functional by default. The kernel's default of 15 is rather long. This commit changes makes the timer settings more aggressive than the kernel's default while still being consistent and allowing proper convergence for a network diameter up to 4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'bridge.c')
-rw-r--r--bridge.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/bridge.c b/bridge.c
index 15e09dd..2ce5c2b 100644
--- a/bridge.c
+++ b/bridge.c
@@ -339,10 +339,8 @@ static void bridge_stp_notify(struct bridge_state *bst)
if (cfg->stp_proto)
blobmsg_add_string(&b, "proto", cfg->stp_proto);
blobmsg_add_u32(&b, "forward_delay", cfg->forward_delay);
- if (cfg->flags & BRIDGE_OPT_HELLO_TIME)
- blobmsg_add_u32(&b, "hello_time", cfg->hello_time);
- if (cfg->flags & BRIDGE_OPT_MAX_AGE)
- blobmsg_add_u32(&b, "max_age", cfg->max_age);
+ blobmsg_add_u32(&b, "hello_time", cfg->hello_time);
+ blobmsg_add_u32(&b, "max_age", cfg->max_age);
if (cfg->flags & BRIDGE_OPT_AGEING_TIME)
blobmsg_add_u32(&b, "ageing_time", cfg->ageing_time);
netifd_ubus_device_notify("stp_init", b.head, 1000);
@@ -1045,7 +1043,6 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
memset(cfg, 0, sizeof(*cfg));
cfg->stp = false;
cfg->stp_kernel = false;
- cfg->forward_delay = 2;
cfg->robustness = 2;
cfg->igmp_snoop = false;
cfg->multicast_querier = false;
@@ -1057,6 +1054,10 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
cfg->priority = 0x7FFF;
cfg->vlan_filtering = false;
+ cfg->forward_delay = 8;
+ cfg->max_age = 10;
+ cfg->hello_time = 1;
+
if ((cur = tb[BRIDGE_ATTR_STP]))
cfg->stp = blobmsg_get_bool(cur);
@@ -1106,15 +1107,11 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
cfg->flags |= BRIDGE_OPT_AGEING_TIME;
}
- if ((cur = tb[BRIDGE_ATTR_HELLO_TIME])) {
+ if ((cur = tb[BRIDGE_ATTR_HELLO_TIME]))
cfg->hello_time = blobmsg_get_u32(cur);
- cfg->flags |= BRIDGE_OPT_HELLO_TIME;
- }
- if ((cur = tb[BRIDGE_ATTR_MAX_AGE])) {
+ if ((cur = tb[BRIDGE_ATTR_MAX_AGE]))
cfg->max_age = blobmsg_get_u32(cur);
- cfg->flags |= BRIDGE_OPT_MAX_AGE;
- }
if ((cur = tb[BRIDGE_ATTR_BRIDGE_EMPTY]))
cfg->bridge_empty = blobmsg_get_bool(cur);