summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-10-15 18:18:16 +0200
committerSteven Barth <steven@midlink.org>2013-10-15 18:18:16 +0200
commit0fa1231d1296d82d8ee75dbe024c9a4509e784fe (patch)
tree78741f9188dd77b5c773956b86e89460de2f3816 /src
parent491200f3ffae5c9599124e0b2eccbdf566de4cf4 (diff)
ubus: register subscriber
Diffstat (limited to 'src')
-rw-r--r--src/config.c2
-rw-r--r--src/ubus.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index 5d29173..a5bcf26 100644
--- a/src/config.c
+++ b/src/config.c
@@ -276,7 +276,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
const char *ifname = NULL;
#ifdef WITH_UBUS
- if (overwrite)
+ if (overwrite || !iface->ifname[0])
ifname = ubus_get_ifname(name);
#endif
if ((c = tb[IFACE_ATTR_IFNAME]))
diff --git a/src/ubus.c b/src/ubus.c
index 55f52dc..9116dd8 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -213,7 +213,6 @@ static int handle_update(_unused struct ubus_context *ctx, _unused struct ubus_o
static void subscribe_netifd(void)
{
- netifd.cb = handle_update;
ubus_subscribe(ubus, &netifd, objid);
ubus_invoke(ubus, objid, "dump", NULL, handle_dump, NULL, 0);
}
@@ -353,6 +352,9 @@ int init_ubus(void)
return -1;
}
+ netifd.cb = handle_update;
+ ubus_register_subscriber(ubus, &netifd);
+
ubus_add_uloop(ubus);
ubus_add_object(ubus, &main_object);
ubus_register_event_handler(ubus, &event_handler, "ubus.object.add");