[dhcp/f18] Expose next-server DHCPv4 option to dhclient script

Tomas Hozza thozza at fedoraproject.org
Wed Apr 3 16:05:48 UTC 2013


commit 63b860bd804119a47164c449b09f3e9b28e53317
Author: Tomas Hozza <thozza at redhat.com>
Date:   Wed Apr 3 17:59:42 2013 +0200

    Expose next-server DHCPv4 option to dhclient script
    
    Signed-off-by: Tomas Hozza <thozza at redhat.com>

 dhcp-4.2.5-next-server.patch |   72 ++++++++++++++++++++++++++++++++++++++++++
 dhcp.spec                    |   10 +++++-
 2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/dhcp-4.2.5-next-server.patch b/dhcp-4.2.5-next-server.patch
new file mode 100644
index 0000000..c903bd1
--- /dev/null
+++ b/dhcp-4.2.5-next-server.patch
@@ -0,0 +1,72 @@
+From f113ad7822fcd691e72f61cab7412595951222db Mon Sep 17 00:00:00 2001
+From: Tomas Hozza <thozza at redhat.com>
+Date: Wed, 3 Apr 2013 10:20:18 +0200
+Subject: [PATCH] Expose next-server DHCPv4 option to dhclient script
+
+Currently dhclient does not exposes next-server option
+to the dhclient script. this patch fixes this.
+
+Signed-off-by: Tomas Hozza <thozza at redhat.com>
+---
+ client/dhclient.c | 14 +++++++++++---
+ includes/dhcpd.h  |  2 +-
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/client/dhclient.c b/client/dhclient.c
+index 551ccbf..e8df320 100644
+--- a/client/dhclient.c
++++ b/client/dhclient.c
+@@ -993,7 +993,7 @@ void state_selecting (cpp)
+ 		client -> state = S_REQUESTING;
+ 
+ 		/* Bind to the address we received. */
+-		bind_lease (client);
++		bind_lease (client, NULL);
+ 		return;
+ 	}
+ 
+@@ -1183,11 +1183,12 @@ void dhcpack (packet)
+ 	if (client -> new -> rebind < cur_time)
+ 		client -> new -> rebind = TIME_MAX;
+ 
+-	bind_lease (client);
++	bind_lease (client, &packet -> raw -> siaddr);
+ }
+ 
+-void bind_lease (client)
++void bind_lease (client, siaddr)
+ 	struct client_state *client;
++	struct in_addr *siaddr;
+ {
+ 	struct timeval tv;
+ 
+@@ -1209,6 +1210,13 @@ void bind_lease (client)
+ 	if (client -> alias)
+ 		script_write_params (client, "alias_", client -> alias);
+ 
++	if (siaddr) {
++		char buf[INET_ADDRSTRLEN];
++
++		if (inet_ntop (AF_INET, (void *) siaddr, buf, sizeof (buf)))
++			client_envadd (client, "new_", "next_server", "%s", buf);
++	}
++
+ 	/* If the BOUND/RENEW code detects another machine using the
+ 	   offered address, it exits nonzero.  We need to send a
+ 	   DHCPDECLINE and toss the lease. */
+diff --git a/includes/dhcpd.h b/includes/dhcpd.h
+index 12ed2ba..4e93e68 100644
+--- a/includes/dhcpd.h
++++ b/includes/dhcpd.h
+@@ -2712,7 +2712,7 @@ void state_bound (void *);
+ void state_stop (void *);
+ void state_panic (void *);
+ 
+-void bind_lease (struct client_state *);
++void bind_lease (struct client_state *, struct in_addr *);
+ 
+ void make_client_options (struct client_state *,
+ 			  struct client_lease *, u_int8_t *,
+-- 
+1.8.1.4
+
diff --git a/dhcp.spec b/dhcp.spec
index b6605da..93d628e 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.5
-Release:  8%{?dist}
+Release:  9%{?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.
@@ -78,6 +78,7 @@ Patch44:  dhcp-4.2.4-P1-interval.patch
 Patch45:  dhcp-4.2.4-P2-conflex-do-forward-updates.patch
 Patch46:  dhcp-4.2.4-P2-dupl-key.patch
 Patch47:  dhcp-4.2.5-range6.patch
+Patch48:  dhcp-4.2.5-next-server.patch
 
 BuildRequires: autoconf
 BuildRequires: automake
@@ -337,6 +338,10 @@ rm -rf includes/isc-dhcp
 # (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #32453])
 %patch47 -p1 -b .range6
 
+# Expose next-server DHCPv4 option to dhclient script
+# (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #33098])
+%patch48 -p1 -b .next-server
+
 # Update paths in all man pages
 for page in client/dhclient.conf.5 client/dhclient.leases.5 \
             client/dhclient-script.8 client/dhclient.8 ; do
@@ -580,6 +585,9 @@ done
 
 
 %changelog
+* Wed Apr 03 2013 Tomas Hozza <thozza at redhat.com> - 12:4.2.5-9
+- Expose next-server DHCPv4 option to dhclient script
+
 * Tue Mar 26 2013 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.5-8
 - describe -user/-group/-chroot in dhcpd.8
 


More information about the scm-commits mailing list