summaryrefslogtreecommitdiff
path: root/ubus.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2014-04-24 07:51:15 +0000
committerSteven Barth <steven@midlink.org>2014-04-24 11:13:26 +0200
commit372fa0f3f867eee4b949727aa5c2e4fa9e728d55 (patch)
tree51be50d08bf836db2151d6b3b8a2e887c98aabab /ubus.c
parent235a02424c3ab1b59308895c4f00395dacf2557c (diff)
downloadnetifd-372fa0f3f867eee4b949727aa5c2e4fa9e728d55.tar.gz
netifd: Mark interface as dynamic after it has been added in the interface list
Adding an interface in the interface list in case of a config update will override the node version of the old interface and thus overriding the dynamic interface marker. In case of config update interface_set_dynamic is done on an invalid interface pointer as the new interface pointer has been freed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ubus.c b/ubus.c
index aeb864f..02becf2 100644
--- a/ubus.c
+++ b/ubus.c
@@ -147,13 +147,16 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
goto error;
interface_add(iface, config);
- interface_set_dynamic(iface);
- // need to look up the interface name again, in case of config update,
+ // need to look up the interface name again, in case of config update
+ // the pointer will have changed
iface = vlist_find(&interfaces, name, iface, node);
if (!iface)
return UBUS_STATUS_UNKNOWN_ERROR;
+ // Set interface as dynamic
+ interface_set_dynamic(iface);
+
dev = iface->main_dev.dev;
if (!dev || !dev->default_config)
return UBUS_STATUS_UNKNOWN_ERROR;