X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=config.c;h=4e91e1854e5bca3404e9b33f6077dea201750532;hp=7e2d1edbd0a24dda792c65d218bb4ae14d7f48ab;hb=500779b3750d8a7603401128f6eb4e942e684616;hpb=942aa06b7e8b74680b18022f7d002a8013b7bd5d diff --git a/config.c b/config.c index 7e2d1ed..4e91e18 100644 --- a/config.c +++ b/config.c @@ -105,7 +105,7 @@ config_parse_interface(struct uci_section *s, bool alias) if (iface->proto_handler && iface->proto_handler->config_params) uci_to_blob(&b, s, iface->proto_handler->config_params); - if (!bridge && uci_to_blob(&b, s, simple_device_type.config_params)) + if (!bridge && uci_to_blob(&b, s, simple_device_type.config_params) > 1) iface->device_config = true; config = blob_memdup(b.head); @@ -136,7 +136,8 @@ config_parse_interface(struct uci_section *s, bool alias) if (blob_len(b.head) == 0) return; - device_set_config(dev, dev->type, b.head); + if (iface->device_config && dev->default_config) + device_set_config(dev, dev->type, b.head); return; error_free_config: free(config); @@ -209,14 +210,17 @@ config_init_devices(void) blob_buf_init(&b, 0); uci_to_blob(&b, s, params); if (devtype) { - device_create(name, devtype, b.head); + dev = device_create(name, devtype, b.head); + if (!dev) + continue; } else { dev = device_get(name, 1); if (!dev) continue; - device_set_config(dev, dev->type, b.head); + device_apply_config(dev, dev->type, b.head); } + dev->default_config = false; } }