1
From: Mathieu Trudel-Lapierre <mathieu-tl@ubuntu.com>
2
Subject: Detect dhclient version at compile-time, and skip IP options -4,-6,
3
as well as mode options when using dhclient V3.
4
Last-Update: 2010-08-09
6
Index: network-manager-0.8.1+git.20100715t004920.72399bf/configure.ac
7
===================================================================
8
--- network-manager-0.8.1+git.20100715t004920.72399bf.orig/configure.ac 2010-07-14 23:25:53.000000000 -0400
9
+++ network-manager-0.8.1+git.20100715t004920.72399bf/configure.ac 2010-08-09 15:50:07.968129649 -0400
11
for path in /sbin /usr/sbin /usr/pkg/sbin /usr/local/sbin; do
12
test -x "${path}/dhclient" || continue
13
case `"$path/dhclient" --version 2>&1` in
14
- "isc-dhclient-4"*) DHCLIENT_PATH="$path/dhclient"; break;;
15
+ "isc-dhclient-4"*) DHCLIENT_PATH="$path/dhclient"; DHCLIENT_VERSION=4; break;;
16
+ "isc-dhclient-V3"*) DHCLIENT_PATH="$path/dhclient"; DHCLIENT_VERSION=3; break;;
19
if test -n "${DHCLIENT_PATH}"; then
24
+ if test -n "${DHCLIENT_VERSION}"; then
25
+ AC_MSG_NOTICE(Found dhclient version ${DHCLIENT_VERSION}.)
26
+ AC_SUBST(DHCLIENT_VERSION)
31
Index: network-manager-0.8.1+git.20100715t004920.72399bf/src/dhcp-manager/Makefile.am
32
===================================================================
33
--- network-manager-0.8.1+git.20100715t004920.72399bf.orig/src/dhcp-manager/Makefile.am 2010-07-14 23:25:53.000000000 -0400
34
+++ network-manager-0.8.1+git.20100715t004920.72399bf/src/dhcp-manager/Makefile.am 2010-08-09 15:50:07.968129649 -0400
36
-DLIBEXECDIR=\"$(libexecdir)\" \
37
-DLOCALSTATEDIR=\"$(localstatedir)\" \
38
-DDHCLIENT_PATH=\"$(DHCLIENT_PATH)\" \
39
+ -DDHCLIENT_V$(DHCLIENT_VERSION) \
40
-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
42
libdhcp_manager_la_LIBADD = \
43
Index: network-manager-0.8.1+git.20100715t004920.72399bf/src/dhcp-manager/nm-dhcp-dhclient.c
44
===================================================================
45
--- network-manager-0.8.1+git.20100715t004920.72399bf.orig/src/dhcp-manager/nm-dhcp-dhclient.c 2010-07-14 23:25:53.000000000 -0400
46
+++ network-manager-0.8.1+git.20100715t004920.72399bf/src/dhcp-manager/nm-dhcp-dhclient.c 2010-08-09 15:53:43.620144945 -0400
48
#define NM_DHCP_DHCLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP_DHCLIENT, NMDHCPDhclientPrivate))
50
#if defined(TARGET_DEBIAN) || defined(TARGET_SUSE) || defined(TARGET_MANDRIVA)
51
+#if defined(DHCLIENT_V3)
52
+#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhcp3"
54
#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhcp"
57
#define NM_DHCLIENT_LEASE_DIR LOCALSTATEDIR "/lib/dhclient"
60
#if defined(TARGET_SUSE)
61
orig = g_strdup (SYSCONFDIR "/dhclient.conf");
62
#elif defined(TARGET_DEBIAN) || defined(TARGET_GENTOO)
63
+#if defined(DHCLIENT_V3)
64
+ orig = g_strdup (SYSCONFDIR "/dhcp3/dhclient.conf");
66
orig = g_strdup (SYSCONFDIR "/dhcp/dhclient.conf");
69
orig = g_strdup_printf (SYSCONFDIR "/dhclient-%s.conf", iface);
74
g_return_val_if_fail (priv->pid_file == NULL, -1);
75
- g_return_val_if_fail (ip_opt != NULL, -1);
77
iface = nm_dhcp_client_get_iface (client);
78
uuid = nm_dhcp_client_get_uuid (client);
81
g_ptr_array_add (argv, (gpointer) "-d");
83
+#if !defined(DHCLIENT_V3)
84
+ g_return_val_if_fail (ip_opt != NULL, -1);
85
g_ptr_array_add (argv, (gpointer) ip_opt);
88
g_ptr_array_add (argv, (gpointer) mode_opt);
91
g_ptr_array_add (argv, (gpointer) "-sf"); /* Set script file */
92
g_ptr_array_add (argv, (gpointer) ACTION_SCRIPT_PATH );