From a4d401cd798841792c4bba7d06405aa7879bd221 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 13 May 2010 13:08:32 +0200 Subject: [PATCH] Check for dhclient hostname support --- configure.ac | 6 ++++++ plugins/dhclient.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index 3fc7b88..94d518e 100644 --- a/configure.ac +++ b/configure.ac @@ -128,6 +128,12 @@ if (test "${enable_dhclient}" != "no"); then DHCLIENT="${path_dhclient}" AC_SUBST(DHCLIENT) fi + AC_MSG_CHECKING(dhclient major version) + version_dhclient=`${DHCLIENT} --version 2>&1 | sed '/^isc-dhclient-*/!d; s///; s/\..*//;q'` + AC_MSG_RESULT(${version_dhclient}) + if (test "${version_dhclient}" = "4"); then + AC_DEFINE(HAVE_DHCLIENT_HOSTNAME, 1, [Define to 1 if you have dhclient hostname support.]) + fi fi AM_CONDITIONAL(DHCLIENT, test "${enable_dhclient}" != "no") AM_CONDITIONAL(DHCLIENT_BUILTIN, test "${enable_dhclient}" = "builtin") diff --git a/plugins/dhclient.c b/plugins/dhclient.c index d29b1d6..fd86773 100644 --- a/plugins/dhclient.c +++ b/plugins/dhclient.c @@ -147,8 +147,10 @@ static void dhclient_setup(struct connman_task *task, const char *ifname) connman_task_add_argument(task, "-sf", "%s/dhclient-script", SCRIPTDIR); hostname = connman_utsname_get_hostname(); +#ifdef HAVE_DHCLIENT_HOSTNAME if (hostname != NULL) connman_task_add_argument(task, "-H", hostname); +#endif connman_task_add_argument(task, ifname, NULL); connman_task_add_argument(task, "-n", NULL); -- 2.7.4