X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface.c;h=b9833d30b5cfaa1f34c4ab3c081e84ad2b88dccf;hp=2aab37cc9ecdf97949c94a9a62d44633fa3e4785;hb=c007f08413edc15805c248a8d65f075bb5fb0bdd;hpb=6a84e770ed9f4ea0ffe9b20625f8f15868f5424b diff --git a/interface.c b/interface.c index 2aab37c..b9833d3 100644 --- a/interface.c +++ b/interface.c @@ -189,6 +189,9 @@ interface_add_data(struct interface *iface, const struct blob_attr *data) } n = calloc(1, sizeof(*n) + len); + if (!n) + return UBUS_STATUS_UNKNOWN_ERROR; + memcpy(n->data, data, len); n->node.key = blobmsg_name(n->data); avl_insert(&iface->data, &n->node); @@ -257,6 +260,7 @@ mark_interface_down(struct interface *iface) if (state == IFS_DOWN) return; + iface->link_up_event = false; iface->state = IFS_DOWN; if (state == IFS_UP) interface_event(iface, IFEV_DOWN); @@ -352,6 +356,11 @@ interface_set_link_state(struct interface *iface, bool new_state) netifd_log_message(L_NOTICE, "Interface '%s' has link connectivity %s\n", iface->name, new_state ? "" : "loss"); iface->link_state = new_state; interface_check_state(iface); + + if (new_state && iface->force_link && iface->state == IFS_UP && !iface->link_up_event) { + interface_event(iface, IFEV_LINK_UP); + iface->link_up_event = true; + } } static void @@ -547,8 +556,7 @@ interface_alias_cb(struct interface_user *dep, struct interface *iface, enum int case IFEV_FREE: interface_remove_user(dep); break; - case IFEV_RELOAD: - case IFEV_UPDATE: + default: break; } }