nterface-ip: remove superfluous iface check in interface_ip_set_enabled()
[project/netifd.git] / interface-event.c
index 3cdfbdb..86e8f54 100644 (file)
@@ -30,7 +30,15 @@ static void task_complete(struct uloop_process *proc, int ret);
 static struct uloop_process task = {
        .cb = task_complete,
 };
-static const char * const eventnames[] = {"ifdown", "ifup", "ifupdate", "free", "reload"};
+static const char * const eventnames[] = {
+       [IFEV_DOWN] = "ifdown",
+       [IFEV_UP] = "ifup",
+       [IFEV_UP_FAILED] = "ifup-failed",
+       [IFEV_UPDATE] = "ifupdate",
+       [IFEV_FREE] = "free",
+       [IFEV_RELOAD] = "reload",
+       [IFEV_LINK_UP] = "iflink",
+};
 
 static void
 run_cmd(const char *ifname, const char *device, enum interface_event event,
@@ -117,6 +125,10 @@ interface_queue_event(struct interface *iface, enum interface_event ev)
 
        netifd_ubus_interface_notify(iface, ev != IFEV_DOWN);
 
+       /* no hotplug.d calls for link up */
+       if (ev == IFEV_LINK_UP)
+               return;
+
        if (current == iface) {
                /* an event for iface is being processed */
                if (!list_empty(&iface->hotplug_list)) {
@@ -178,15 +190,18 @@ static void interface_event_cb(struct interface_user *dep, struct interface *ifa
                               enum interface_event ev)
 {
        switch (ev) {
+               case IFEV_LINK_UP:
                case IFEV_UP:
+               case IFEV_UP_FAILED:
                case IFEV_UPDATE:
                case IFEV_DOWN:
                        interface_queue_event(iface, ev);
                        break;
                case IFEV_FREE:
-               case IFEV_RELOAD:
                        interface_dequeue_event(iface);
                        break;
+               default:
+                       break;
        }
 }