+static struct dhclient_task *find_task_by_index(int index)
+{
+ GSList *list;
+
+ for (list = tasks; list; list = list->next) {
+ struct dhclient_task *task = list->data;
+
+ if (task->ifindex == index)
+ return task;
+ }
+
+ return NULL;
+}
+
+static void kill_task(struct dhclient_task *task)
+{
+ char pathname[PATH_MAX];
+
+ kill(task->pid, SIGTERM);
+
+ snprintf(pathname, sizeof(pathname) - 1,
+ "%s/dhclient.%s.pid", STATEDIR, task->ifname);
+ unlink(pathname);
+
+ snprintf(pathname, sizeof(pathname) - 1,
+ "%s/dhclient.%s.leases", STATEDIR, task->ifname);
+ unlink(pathname);
+
+ free(task->ifname);
+
+ g_free(task);
+}
+