netifd: Fix macvlan delete via netlink
[project/netifd.git] / ubus.c
diff --git a/ubus.c b/ubus.c
index aeb864f..cec2e88 100644 (file)
--- 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;
@@ -1161,7 +1164,7 @@ netifd_ubus_interface_event(struct interface *iface, bool up)
 void
 netifd_ubus_interface_notify(struct interface *iface, bool up)
 {
-       const char *event = (up) ? "update" : "down";
+       const char *event = (up) ? "interface.update" : "interface.down";
        blob_buf_init(&b, 0);
        blobmsg_add_string(&b, "interface", iface->name);
        netifd_dump_status(iface);