X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface.c;h=60efc7e43950fc8f28bc97289cee59ea1a5089ca;hp=8c1c006d49be95fddbf8632fd02981bca701ef12;hb=6d99c7d319393a0a1bf1cc091ab60568f8f70a99;hpb=a047e6bc29fb9c3e62c0835e55b9c6322ec62f05 diff --git a/interface.c b/interface.c index 8c1c006..60efc7e 100644 --- a/interface.c +++ b/interface.c @@ -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);