*
* Connection Manager
*
- * Copyright (C) 2007 Intel Corporation. All rights reserved.
+ * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#include <connman/plugin.h>
#include <connman/dhcp.h>
+#include <connman/dbus.h>
#define DHCLIENT_INTF "org.isc.dhclient"
#define DHCLIENT_PATH "/org/isc/dhclient"
static void kill_task(struct dhclient_task *task)
{
- char pathname[PATH_MAX];
-
if (task->pid > 0)
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);
}
static void task_died(GPid pid, gint status, gpointer data)
{
struct dhclient_task *task = data;
+ char pathname[PATH_MAX];
if (WIFEXITED(status))
printf("[DHCP] exit status %d for %s\n",
tasks = g_slist_remove(tasks, task);
- kill_task(task);
+ 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);
}
static void task_setup(gpointer data)
connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
busname = dbus_bus_get_unique_name(connection);
-
- busname = "org.freedesktop.connman";
+ busname = CONNMAN_SERVICE;
dbus_connection_add_filter(connection, dhclient_filter, NULL, NULL);