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>
if (cfg->stp_proto)
blobmsg_add_string(&b, "proto", cfg->stp_proto);
blobmsg_add_u32(&b, "forward_delay", cfg->forward_delay);
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);
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);
memset(cfg, 0, sizeof(*cfg));
cfg->stp = false;
cfg->stp_kernel = false;
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;
cfg->robustness = 2;
cfg->igmp_snoop = false;
cfg->multicast_querier = false;
cfg->priority = 0x7FFF;
cfg->vlan_filtering = false;
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);
if ((cur = tb[BRIDGE_ATTR_STP]))
cfg->stp = blobmsg_get_bool(cur);
cfg->flags |= BRIDGE_OPT_AGEING_TIME;
}
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->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->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);
if ((cur = tb[BRIDGE_ATTR_BRIDGE_EMPTY]))
cfg->bridge_empty = blobmsg_get_bool(cur);
snprintf(buf, sizeof(buf), "%d", cfg->priority);
system_bridge_set_priority(bridge, buf);
snprintf(buf, sizeof(buf), "%d", cfg->priority);
system_bridge_set_priority(bridge, buf);
+ snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->hello_time));
+ system_bridge_set_hello_time(bridge, buf);
+
+ snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->max_age));
+ system_bridge_set_max_age(bridge, buf);
+
if (cfg->flags & BRIDGE_OPT_AGEING_TIME) {
snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->ageing_time));
system_bridge_set_ageing_time(bridge, buf);
}
if (cfg->flags & BRIDGE_OPT_AGEING_TIME) {
snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->ageing_time));
system_bridge_set_ageing_time(bridge, buf);
}
- if (cfg->flags & BRIDGE_OPT_HELLO_TIME) {
- snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->hello_time));
- system_bridge_set_hello_time(bridge, buf);
- }
-
- if (cfg->flags & BRIDGE_OPT_MAX_AGE) {
- snprintf(buf, sizeof(buf), "%lu", sec_to_jiffies(cfg->max_age));
- system_bridge_set_max_age(bridge, buf);
- }
-
extern const struct uci_blob_param_list fmr_data_attr_list;
enum bridge_opt {
extern const struct uci_blob_param_list fmr_data_attr_list;
enum bridge_opt {
- /* stp and forward delay always set */
+ /* stp, forward delay, max age and hello time are always set */
BRIDGE_OPT_AGEING_TIME = (1 << 0),
BRIDGE_OPT_AGEING_TIME = (1 << 0),
- BRIDGE_OPT_HELLO_TIME = (1 << 1),
- BRIDGE_OPT_MAX_AGE = (1 << 2),
- BRIDGE_OPT_ROBUSTNESS = (1 << 3),
- BRIDGE_OPT_QUERY_INTERVAL = (1 << 4),
- BRIDGE_OPT_QUERY_RESPONSE_INTERVAL = (1 << 5),
- BRIDGE_OPT_LAST_MEMBER_INTERVAL = (1 << 6),
+ BRIDGE_OPT_ROBUSTNESS = (1 << 1),
+ BRIDGE_OPT_QUERY_INTERVAL = (1 << 2),
+ BRIDGE_OPT_QUERY_RESPONSE_INTERVAL = (1 << 3),
+ BRIDGE_OPT_LAST_MEMBER_INTERVAL = (1 << 4),
};
struct bridge_config {
};
struct bridge_config {