summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-11-11 21:15:56 +0100
committerHans Dedecker <dedeckeh@gmail.com>2018-11-13 14:28:31 +0100
commit2f7ef7dc6cb542d5811f64fa7af97fb8619c9429 (patch)
tree83e5d724fbaad7212ba5349cee7724023d2cb5b2 /ubus.c
parent841b5d158708ee89d9fa870c40404469cb8e871e (diff)
interface: rework code to get rid of interface_set_dynamic
Integrate dynamic interface creation code into interface_alloc and __interface_add so we can get rid of interface_set_dynamic Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/ubus.c b/ubus.c
index 9c5b8b1..f5e4997 100644
--- a/ubus.c
+++ b/ubus.c
@@ -137,29 +137,22 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj,
const char *name = blobmsg_get_string(tb[DI_NAME]);
- iface = interface_alloc(name, msg);
+ iface = interface_alloc(name, msg, true);
if (!iface)
return UBUS_STATUS_UNKNOWN_ERROR;
config = blob_memdup(msg);
if (!config)
- goto error;
-
- interface_add(iface, config);
-
- // 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;
+ goto error_free;
- // Set interface as dynamic
- interface_set_dynamic(iface);
+ if (!interface_add(iface, config))
+ goto error;
return UBUS_STATUS_OK;
-error:
+error_free:
free(iface);
+error:
return UBUS_STATUS_UNKNOWN_ERROR;
}