void
__interface_set_down(struct interface *iface, bool force)
{
- switch (iface->state) {
+ enum interface_state state = iface->state;
+ switch (state) {
case IFS_UP:
- interface_event(iface, IFEV_DOWN);
case IFS_SETUP:
iface->state = IFS_TEARDOWN;
+ if (state == IFS_UP)
+ interface_event(iface, IFEV_DOWN);
+
interface_proto_event(iface->proto, PROTO_CMD_TEARDOWN, force);
if (force)
interface_flush_state(iface);
}
break;
case IFS_DOWN:
- if (iface->enabled && iface->link_state && !config_init)
+ if (iface->autostart && iface->enabled && iface->link_state && !config_init)
__interface_set_up(iface);
break;
default:
case DEV_EVENT_LINK_DOWN:
interface_set_link_state(iface, new_state);
break;
+ case DEV_EVENT_TOPO_CHANGE:
+ interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
+ return;
default:
break;
}
mark_interface_down(iface);
iface->state = IFS_SETUP;
break;
+ default:
+ return;
}
interface_write_resolv_conf();