X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface.c;h=514b4d5e10035b3aa2e3e000724df73d2e23f41a;hp=b8b3fd13fa983ba69d893b026c6b2a54c93ac82f;hb=a12a0dcdd1b77a652d488ea3d1074e603bc78965;hpb=b357d5f359f32f9f686fe77c63580ecbf6212501 diff --git a/interface.c b/interface.c index b8b3fd1..514b4d5 100644 --- a/interface.c +++ b/interface.c @@ -9,6 +9,7 @@ #include "proto.h" #include "ubus.h" #include "config.h" +#include "system.h" struct vlist_tree interfaces; @@ -78,7 +79,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 @@ -184,6 +185,7 @@ interface_claim_device(struct interface *iface) static void interface_cleanup(struct interface *iface) { + interface_clear_dns(iface); interface_clear_errors(iface); if (iface->main_dev.dev) device_remove_user(&iface->main_dev); @@ -196,6 +198,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); } @@ -237,7 +240,9 @@ interface_proto_cb(struct interface_proto_state *state, enum interface_proto_eve return; iface->state = IFS_UP; + iface->start_time = system_get_rtime(); interface_event(iface, IFEV_UP); + interface_write_resolv_conf(); break; case IFPEV_DOWN: if (iface->state == IFS_DOWN) @@ -245,6 +250,8 @@ interface_proto_cb(struct interface_proto_state *state, enum interface_proto_eve mark_interface_down(iface); interface_handle_config_change(iface); + if (iface->autostart) + __interface_set_up(iface); break; case IFPEV_LINK_LOST: if (iface->state != IFS_UP) @@ -281,6 +288,9 @@ 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); + INIT_LIST_HEAD(&iface->proto_dns_search); + INIT_LIST_HEAD(&iface->proto_dns_servers); iface->main_dev.cb = interface_cb; iface->l3_dev = &iface->main_dev;