[dhcp] dhclient: Don't retry on DECLINE when -1 option used

Jiří Popelka jpopelka at fedoraproject.org
Thu Nov 24 16:28:26 UTC 2011


commit f3cba52167acbabca01e002dc4ffb3d90634c368
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Thu Nov 24 17:26:59 2011 +0100

    dhclient: Don't retry on DECLINE when -1 option used
    
    Don't build with -D_GNU_SOURCE, configure.ac uses AC_USE_SYSTEM_EXTENSIONS

 dhcp-4.2.3-dhclient-decline-onetry.patch |   27 +++++++++++++++++++++++++++
 dhcp.spec                                |   15 +++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/dhcp-4.2.3-dhclient-decline-onetry.patch b/dhcp-4.2.3-dhclient-decline-onetry.patch
new file mode 100644
index 0000000..af3314d
--- /dev/null
+++ b/dhcp-4.2.3-dhclient-decline-onetry.patch
@@ -0,0 +1,27 @@
+diff -up dhcp-4.2.3/client/dhclient.c.decline-onetry dhcp-4.2.3/client/dhclient.c
+--- dhcp-4.2.3/client/dhclient.c.decline-onetry	2011-11-24 14:21:50.000000000 +0100
++++ dhcp-4.2.3/client/dhclient.c	2011-11-24 14:23:44.472893215 +0100
+@@ -1704,11 +1704,18 @@ void bind_lease (client)
+ 	if (script_go (client)) {
+ 		make_decline (client, client -> new);
+ 		send_decline (client);
+-		destroy_client_lease (client -> new);
+-		client -> new = (struct client_lease *)0;
+-		client -> state = S_DECLINED;
+-		state_init (client);
+-		return;
++		if (onetry) {
++			if (!quiet)
++			  log_info ("Unable to obtain a lease on first try.%s",
++					"  Exiting.");
++			exit (2);
++		} else {
++			destroy_client_lease (client -> new);
++			client -> new = (struct client_lease *)0;
++			client -> state = S_DECLINED;
++			state_init (client);
++			return;
++		}
+ 	}
+ 
+ 	/* Write out the new lease if it has been long enough. */
diff --git a/dhcp.spec b/dhcp.spec
index 751f306..bb43eda 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -22,7 +22,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.3
-Release:  6%{?dist}
+Release:  7%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -76,6 +76,7 @@ Patch33:  dhcp-4.2.2-lpf-ib.patch
 Patch34:  dhcp-4.2.2-improved-xid.patch
 Patch35:  dhcp-4.2.2-gpxe-cid.patch
 Patch36:  dhcp-4.2.2-systemtap.patch
+Patch37:  dhcp-4.2.3-dhclient-decline-onetry.patch
 
 BuildRequires: autoconf
 BuildRequires: automake
@@ -328,6 +329,11 @@ rm bind/bind.tar.gz
 # http://sourceware.org/systemtap/wiki/SystemTap
 %patch36 -p1 -b .systemtap
 
+# Send DHCPDECLINE and exit(2) when duplicate address was detected and
+# dhclient had been started with '-1' (#756759).
+# (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #26735])
+%patch37 -p1 -b .decline-onetry
+
 # Copy in the Fedora/RHEL dhclient script
 %{__install} -p -m 0755 %{SOURCE4} client/scripts/linux
 %{__install} -p -m 0644 %{SOURCE5} .
@@ -367,7 +373,7 @@ done
 #libtoolize --copy --force
 autoreconf --verbose --force --install
 
-CFLAGS="%{optflags} -fno-strict-aliasing -D_GNU_SOURCE" \
+CFLAGS="%{optflags} -fno-strict-aliasing" \
 %configure \
     --with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \
     --with-srv6-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd6.leases \
@@ -669,6 +675,11 @@ fi
 %{_initddir}/dhcrelay
 
 %changelog
+* Thu Nov 24 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.3-7
+- Send DHCPDECLINE and exit(2) when duplicate address was detected and
+  dhclient had been started with '-1' (#756759).
+- Don't build with -D_GNU_SOURCE, configure.ac uses AC_USE_SYSTEM_EXTENSIONS
+
 * Mon Nov 14 2011 Adam Tkac <atkac redhat com> - 12:4.2.3-6
 - rebuild against new bind
 


More information about the scm-commits mailing list