summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-23 23:20:29 +0100
committerFelix Fietkau <nbd@openwrt.org>2015-01-23 23:43:26 +0100
commit942aa06b7e8b74680b18022f7d002a8013b7bd5d (patch)
treec9afb32cb5fe2328aa516c9764ac1233dce8b712 /config.c
parent8db8cbbb449ff1f2fd010846061cd2799aef3b43 (diff)
downloadnetifd-942aa06b7e8b74680b18022f7d002a8013b7bd5d.tar.gz
device: add support for specifying a configuration for simple vlan devices
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'config.c')
-rw-r--r--config.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/config.c b/config.c
index 6691e61..7e2d1ed 100644
--- a/config.c
+++ b/config.c
@@ -174,8 +174,10 @@ config_init_devices(void)
struct uci_element *e;
uci_foreach_element(&uci_network->sections, e) {
+ const struct uci_blob_param_list *params = NULL;
struct uci_section *s = uci_to_section(e);
const struct device_type *devtype = NULL;
+ struct device *dev;
const char *type, *name;
if (strcmp(s->type, "device") != 0)
@@ -199,12 +201,22 @@ config_init_devices(void)
devtype = &tunnel_device_type;
}
- if (!devtype)
- devtype = &simple_device_type;
+ if (devtype)
+ params = devtype->config_params;
+ if (!params)
+ params = simple_device_type.config_params;
blob_buf_init(&b, 0);
- uci_to_blob(&b, s, devtype->config_params);
- device_create(name, devtype, b.head);
+ uci_to_blob(&b, s, params);
+ if (devtype) {
+ device_create(name, devtype, b.head);
+ } else {
+ dev = device_get(name, 1);
+ if (!dev)
+ continue;
+
+ device_set_config(dev, dev->type, b.head);
+ }
}
}