[dhcp] turn on using of DUID with DHCPv4 clients (#560361,c#40)

Jiří Popelka jpopelka at fedoraproject.org
Mon Feb 17 16:52:07 UTC 2014


commit 30308a134f5321841426e39ac089a90841655bde
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Mon Feb 17 17:46:53 2014 +0100

    turn on using of DUID with DHCPv4 clients (#560361,c#40)
    
    remove default /etc/dhcp/dhclient.conf

 dhcp-duidv4.patch |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 dhcp.spec         |   29 +++++++-------------
 2 files changed, 88 insertions(+), 19 deletions(-)
---
diff --git a/dhcp-duidv4.patch b/dhcp-duidv4.patch
new file mode 100644
index 0000000..2f51ecb
--- /dev/null
+++ b/dhcp-duidv4.patch
@@ -0,0 +1,78 @@
+diff -up dhcp-4.3.0/client/dhclient.8.duidv4 dhcp-4.3.0/client/dhclient.8
+--- dhcp-4.3.0/client/dhclient.8.duidv4	2014-02-17 16:57:43.000000000 +0100
++++ dhcp-4.3.0/client/dhclient.8	2014-02-17 17:15:25.366604705 +0100
+@@ -454,6 +454,9 @@ used to construct a RFC4361 style client
+ in the client's messages.  This client id can be overridden by
+ setting a client id in the configuration file.  Overridding the
+ client id in this fashion is discouraged.
++This option is turned on by default, if you want to redefine or turn off
++sending of client id, use send dhcp-client-identifier = "better identifier"
++or send dhcp-client-identifier = "" in /etc/dhcp/dhclient.conf.
+ .TP
+ .BI \-I
+ Use the standard DDNS scheme from RFCs 4701 & 4702.  
+diff -up dhcp-4.3.0/client/dhclient.c.duidv4 dhcp-4.3.0/client/dhclient.c
+--- dhcp-4.3.0/client/dhclient.c.duidv4	2014-02-17 16:57:43.000000000 +0100
++++ dhcp-4.3.0/client/dhclient.c	2014-02-17 17:07:24.503358565 +0100
+@@ -72,7 +72,7 @@ struct sockaddr_in sockaddr_broadcast;
+ struct in_addr giaddr;
+ struct data_string default_duid;
+ int duid_type = 0;
+-int duid_v4 = 0;
++int duid_v4 = 1;
+ int std_dhcid = 0;
+ 
+ /* ASSERT_STATE() does nothing now; it used to be
+@@ -1270,7 +1270,7 @@ static void setup_ib_interface(struct in
+ 	}
+ 
+ 	/* No client ID specified */
+-	log_fatal("dhcp-client-identifier must be specified for InfiniBand");
++	//log_fatal("dhcp-client-identifier must be specified for InfiniBand");
+ }
+ 
+ /* Individual States:
+@@ -3314,6 +3314,7 @@ form_duid(struct data_string *duid, cons
+ {
+ 	struct interface_info *ip;
+ 	int len;
++	unsigned hlen;
+ 
+ 	/* For now, just use the first interface on the list. */
+ 	ip = interfaces;
+@@ -3337,6 +3338,11 @@ form_duid(struct data_string *duid, cons
+ 	if (duid_type == 0)
+ 		duid_type = stateless ? DUID_LL : DUID_LLT;
+ 
++	if (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)
++		hlen = 9;
++	else
++		hlen = ip->hw_address.hlen;
++
+ 	/*
+ 	 * 2 bytes for the 'duid type' field.
+ 	 * 2 bytes for the 'htype' field.
+@@ -3344,7 +3350,7 @@ form_duid(struct data_string *duid, cons
+ 	 * enough bytes for the hardware address (note that hw_address has
+ 	 * the 'htype' on byte zero).
+ 	 */
+-	len = 4 + (ip->hw_address.hlen - 1);
++	len = 4 + (hlen - 1);
+ 	if (duid_type == DUID_LLT)
+ 		len += 4;
+ 	if (!buffer_allocate(&duid->buffer, len, MDL))
+@@ -3358,12 +3364,12 @@ form_duid(struct data_string *duid, cons
+ 		putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
+ 		putULong(duid->buffer->data + 4, cur_time - DUID_TIME_EPOCH);
+ 		memcpy(duid->buffer->data + 8, ip->hw_address.hbuf + 1,
+-		       ip->hw_address.hlen - 1);
++		       hlen - 1);
+ 	} else {
+ 		putUShort(duid->buffer->data, DUID_LL);
+ 		putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
+ 		memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
+-		       ip->hw_address.hlen - 1);
++		       hlen - 1);
+ 	}
+ 	
+ 	return ISC_R_SUCCESS;
diff --git a/dhcp.spec b/dhcp.spec
index 665b530..f833484 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.3.0
-Release:  1%{?dist}
+Release:  2%{?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.
@@ -77,6 +77,7 @@ Patch37:  dhcp-range6.patch
 Patch38:  dhcp-next-server.patch
 Patch39:  dhcp-no-subnet-error2info.patch
 Patch40:  dhcp-ffff-checksum.patch
+Patch41:  dhcp-duidv4.patch
 
 
 BuildRequires: autoconf
@@ -287,7 +288,7 @@ rm -rf includes/isc-dhcp
 # (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #24249])
 %patch25 -p1 -b .lpf-ib
 %patch26 -p1 -b .improved-xid
-%patch27 -p1 -b .gpxe-cid
+#%%patch27 -p1 -b .gpxe-cid
 
 # http://sourceware.org/systemtap/wiki/SystemTap
 %patch28 -p1 -b .systemtap
@@ -340,6 +341,9 @@ rm -rf includes/isc-dhcp
 # (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #25587])
 %patch40 -p1 -b .ffff
 
+# Turn on using of DUID with DHCPv4 clients (#560361,c#40)
+%patch41 -p1 -b .duidv4
+
 # 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
@@ -476,22 +480,6 @@ EOF
 #
 EOF
 
-# Install default dhclient.conf:
-%{__mkdir} -p %{buildroot}%{dhcpconfdir}
-%{__cat} << EOF > %{buildroot}%{dhcpconfdir}/dhclient.conf
-#
-# DHCP Client Configuration file.
-#   see /usr/share/doc/dhclient/dhclient.conf.example
-#   see dhclient.conf(5) man page
-#
-# Send client identifier as "hardware-type.link-layer address" (e.g. "1.c2.23.7d.c3.52.2c")
-# Required in environments where a bridge might be clobbering the forwarded
-# packet's MAC address (common in Wifi, Docsis, or ADSL bridging scenarios)
-# see dhcp-options(5) man page for 'dhcp-client-identifier'
-# see dhcp-eval(5) man page for 'hardware'
-send dhcp-client-identifier = hardware;
-EOF
-
 # Install dhcp.schema for LDAP configuration
 %{__mkdir} -p %{buildroot}%{_sysconfdir}/openldap/schema
 %{__install} -p -m 0644 -D contrib/ldap/dhcp.schema \
@@ -592,7 +580,6 @@ done
 %files -n dhclient
 %doc client/dhclient.conf.example client/dhclient6.conf.example README.dhclient.d
 %attr(0750,root,root) %dir %{dhcpconfdir}
-%config(noreplace) %{dhcpconfdir}/dhclient.conf
 %dir %{dhcpconfdir}/dhclient.d
 %dir %{_localstatedir}/lib/dhclient
 %dir %{_sysconfdir}/NetworkManager
@@ -626,6 +613,10 @@ done
 
 
 %changelog
+* Mon Feb 17 2014 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.0-2
+- turn on using of DUID with DHCPv4 clients (#560361,c#40)
+- remove default /etc/dhcp/dhclient.conf
+
 * Tue Feb 04 2014 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.0-1
 - 4.3.0
 


More information about the scm-commits mailing list