add support for calls to a hotplug script on interface state changes
[project/netifd.git] / interface.c
index b8b3fd1..3820050 100644 (file)
@@ -78,7 +78,7 @@ void interface_add_error(struct interface *iface, const char *subsystem,
 static void
 interface_event(struct interface *iface, enum interface_event ev)
 {
-       /* TODO */
+       interface_queue_event(iface, ev);
 }
 
 static void
@@ -196,6 +196,7 @@ interface_do_free(struct interface *iface)
        interface_cleanup(iface);
        free(iface->config);
        netifd_ubus_remove_interface(iface);
+       avl_delete(&interfaces.avl, &iface->node.avl);
        free(iface);
 }
 
@@ -281,6 +282,7 @@ interface_init(struct interface *iface, const char *name,
 
        strncpy(iface->name, name, sizeof(iface->name) - 1);
        INIT_LIST_HEAD(&iface->errors);
+       INIT_LIST_HEAD(&iface->hotplug_list);
 
        iface->main_dev.cb = interface_cb;
        iface->l3_dev = &iface->main_dev;