device: Don't process link events anymore in device user specific callback handlers
[project/netifd.git] / interface.c
index 5166c0c75d6f2d2f04d190f8a2d57563d8f13101..ffe79880779081327c2a5741310218c696c0efa6 100644 (file)
@@ -73,6 +73,9 @@ const struct uci_blob_param_list interface_attr_list = {
        .params = iface_attrs,
 };
 
+static void
+set_config_state(struct interface *iface, enum interface_config_state s);
+
 static void
 interface_error_flush(struct interface *iface)
 {
@@ -256,9 +259,6 @@ __interface_set_down(struct interface *iface, bool force)
                interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force);
                if (force)
                        interface_flush_state(iface);
-
-               if (iface->dynamic)
-                       vlist_delete(&interfaces, &iface->node);
                break;
 
        case IFS_DOWN:
@@ -644,10 +644,12 @@ interface_handle_config_change(struct interface *iface)
        }
        if (iface->autostart && iface->available)
                interface_set_up(iface);
+       else if (iface->dynamic)
+               set_config_state(iface, IFC_REMOVE);
 }
 
 static void
-interface_proto_cb(struct interface_proto_state *state, enum interface_proto_event ev)
+interface_proto_event_cb(struct interface_proto_state *state, enum interface_proto_event ev)
 {
        struct interface *iface = state->iface;
 
@@ -706,7 +708,7 @@ void interface_set_proto_state(struct interface *iface, struct interface_proto_s
        if (!state)
                return;
 
-       state->proto_event = interface_proto_cb;
+       state->proto_event = interface_proto_event_cb;
        state->iface = iface;
 }