static struct uloop_process task = {
.cb = task_complete,
};
-static const char * const eventnames[] = {"ifdown", "ifup", "ifupdate", "free", "reload"};
+static const char * const eventnames[] = {
+ [IFEV_DOWN] = "ifdown",
+ [IFEV_UP] = "ifup",
+ [IFEV_UPDATE] = "ifupdate",
+ [IFEV_FREE] = "free",
+ [IFEV_RELOAD] = "reload",
+ [IFEV_LINK_UP] = "iflink",
+};
static void
run_cmd(const char *ifname, const char *device, enum interface_event event,
enum interface_event ev)
{
switch (ev) {
+ case IFEV_LINK_UP:
case IFEV_UP:
case IFEV_UPDATE:
case IFEV_DOWN:
if (state == IFS_DOWN)
return;
+ iface->link_up_event = false;
iface->state = IFS_DOWN;
if (state == IFS_UP)
interface_event(iface, IFEV_DOWN);
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
case IFEV_FREE:
interface_remove_user(dep);
break;
- case IFEV_RELOAD:
- case IFEV_UPDATE:
+ default:
break;
}
}