From c1c2728946b5bedb7a4757d9dd95744dc7d2f1ec Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 18 Nov 2020 15:15:01 +0100 Subject: 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 --- config.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'config.c') 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(); -- cgit v1.2.1