summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-11-18 15:15:01 +0100
committerFelix Fietkau <nbd@nbd.name>2020-11-18 15:36:49 +0100
commitc1c2728946b5bedb7a4757d9dd95744dc7d2f1ec (patch)
tree9b9cea09f662c4ba0383cc83894ee5f0ef5348a6 /config.c
parent351d690f1a09e062ef951ac406ee571e1f1fe3e6 (diff)
downloadnetifd-c1c2728946b5bedb7a4757d9dd95744dc7d2f1ec.tar.gz
config: initialize bridge and bridge vlans before other devices
This allows vlan devices to access bridge vlan data safely, regardless of the order in which sections appear in the config Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/config.c b/config.c
index 8122a95..563dedc 100644
--- a/config.c
+++ b/config.c
@@ -221,7 +221,7 @@ config_parse_rule(struct uci_section *s, bool v6)
}
static void
-config_init_devices(void)
+config_init_devices(bool bridge)
{
struct uci_element *e;
@@ -243,6 +243,9 @@ config_init_devices(void)
if (type)
devtype = device_type_get(type);
+ if (bridge != (devtype && devtype->bridge_capability))
+ continue;
+
if (devtype)
params = devtype->config_params;
if (!params)
@@ -672,9 +675,10 @@ config_init_all(void)
device_lock();
device_reset_config();
- config_init_devices();
- config_init_interfaces();
+ config_init_devices(true);
config_init_vlans();
+ config_init_devices(false);
+ config_init_interfaces();
config_init_ip();
config_init_rules();
config_init_globals();