Send system hostname with dhclient execution
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 12 May 2010 17:15:13 +0000 (19:15 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 May 2010 17:15:13 +0000 (19:15 +0200)
plugins/dhclient.c
scripts/dhclient.conf

index ed170ed..d29b1d6 100644 (file)
@@ -32,6 +32,7 @@
 
 #define CONNMAN_API_SUBJECT_TO_CHANGE
 #include <connman/plugin.h>
+#include <connman/utsname.h>
 #include <connman/dhcp.h>
 #include <connman/task.h>
 #include <connman/log.h>
@@ -129,6 +130,7 @@ static void dhclient_died(struct connman_task *task, void *user_data)
 static void dhclient_setup(struct connman_task *task, const char *ifname)
 {
        const char *path, *intf = "org.moblin.connman.Task";
+       const char *hostname;
 
        path = connman_task_get_path(task);
 
@@ -143,6 +145,11 @@ static void dhclient_setup(struct connman_task *task, const char *ifname)
                                                        STATEDIR, ifname);
        connman_task_add_argument(task, "-cf", "%s/dhclient.conf", SCRIPTDIR);
        connman_task_add_argument(task, "-sf", "%s/dhclient-script", SCRIPTDIR);
+
+       hostname = connman_utsname_get_hostname();
+       if (hostname != NULL)
+               connman_task_add_argument(task, "-H", hostname);
+
        connman_task_add_argument(task, ifname, NULL);
        connman_task_add_argument(task, "-n", NULL);
 }
index 3ed1829..39741b1 100644 (file)
@@ -1,4 +1,3 @@
-send host-name "<hostname>";
 option proxy-auto-config code 252 = text;
 request subnet-mask, broadcast-address, routers, host-name,
        domain-search, domain-name, domain-name-servers,