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_UP_FAILED] = "ifup-failed",
+ [IFEV_UPDATE] = "ifupdate",
+ [IFEV_FREE] = "free",
+ [IFEV_RELOAD] = "reload",
+ [IFEV_LINK_UP] = "iflink",
+ [IFEV_CREATE] = "create",
+};
static void
run_cmd(const char *ifname, const char *device, enum interface_event event,
int pid;
pid = fork();
- if (pid < 0)
- return task_complete(NULL, -1);
+ if (pid < 0) {
+ task_complete(NULL, -1);
+ return;
+ }
if (pid > 0) {
task.pid = pid;
netifd_ubus_interface_notify(iface, ev != IFEV_DOWN);
+ /* no hotplug.d calls for link up */
+ if (ev == IFEV_LINK_UP)
+ return;
+
if (current == iface) {
/* an event for iface is being processed */
if (!list_empty(&iface->hotplug_list)) {
enum interface_event ev)
{
switch (ev) {
+ case IFEV_LINK_UP:
case IFEV_UP:
+ case IFEV_UP_FAILED:
case IFEV_UPDATE:
case IFEV_DOWN:
interface_queue_event(iface, ev);
break;
case IFEV_FREE:
- case IFEV_RELOAD:
interface_dequeue_event(iface);
break;
+ default:
+ break;
}
}