extend vlist code to allow keeping the old data structure instead of the new one...
[project/netifd.git] / interface.c
index 8c1c006..60efc7e 100644 (file)
@@ -185,6 +185,13 @@ interface_proto_cb(struct interface_proto_state *state, enum interface_proto_eve
 
                mark_interface_down(iface);
                break;
+       case IFPEV_LINK_LOST:
+               if (iface->state != IFS_UP)
+                       return;
+
+               iface->state = IFS_SETUP;
+               interface_event(iface, IFEV_DOWN);
+               break;
        }
 }
 
@@ -219,7 +226,7 @@ interface_alloc(const char *name, struct blob_attr *attr)
 
        iface = calloc(1, sizeof(*iface));
        iface->main_dev.cb = interface_cb;
-       iface->l3_iface = &iface->main_dev;
+       iface->l3_dev = &iface->main_dev;
        strncpy(iface->name, name, sizeof(iface->name) - 1);
        list_add_tail(&iface->list, &interfaces);
        INIT_LIST_HEAD(&iface->errors);
@@ -234,7 +241,9 @@ interface_alloc(const char *name, struct blob_attr *attr)
 
        proto_attach_interface(iface, proto_name);
 
-       if ((cur = tb[IFACE_ATTR_IFNAME])) {
+       if (iface->proto_handler &&
+           !(iface->proto_handler->flags & PROTO_FLAG_NODEV) &&
+           (cur = tb[IFACE_ATTR_IFNAME])) {
                dev = device_get(blobmsg_data(cur), true);
                if (dev)
                        device_add_user(&iface->main_dev, dev);