[dhcp] bind DHCPv6 client to link-local address instead of 0 address (#1001742)

Jiří Popelka jpopelka at fedoraproject.org
Thu Sep 12 16:23:25 UTC 2013


commit aebaf50d8d99fc014279a2e6c7c9ca4ed634e285
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Thu Sep 12 18:15:47 2013 +0200

    bind DHCPv6 client to link-local address instead of 0 address (#1001742)

 dhcp-bind-link-local.patch |   56 ++++++++++++++++++++++++++++++++++++++++++++
 dhcp.spec                  |   10 +++++++-
 2 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/dhcp-bind-link-local.patch b/dhcp-bind-link-local.patch
new file mode 100644
index 0000000..d7f6578
--- /dev/null
+++ b/dhcp-bind-link-local.patch
@@ -0,0 +1,56 @@
+From f81438c1a7a4fe921e887f431de63d42c38f8623 Mon Sep 17 00:00:00 2001
+From: Jiri Popelka <jpopelka at redhat.com>
+Date: Thu, 12 Sep 2013 13:25:17 +0200
+Subject: [PATCH] Bind 'dhclient -6' to link local address.
+
+When there are more 'dhclient -6' instances running
+(one instance per network interface),
+always only one of them gets all the packets
+(even those destined for the other instances).
+The exact behaviour depends on linux kernel version, either only the
+first or only the last started instance gets all the packets,
+but the problem remains.
+
+I think the problem is that DHCPv6 part of if_register_socket() binds to
+address from local_address6 variable but this variable has never been
+initialized so it's always 0.
+
+The solution could be to bind to link local address of interface.
+---
+ common/socket.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/common/socket.c b/common/socket.c
+index f95665c..c4af83a 100644
+--- a/common/socket.c
++++ b/common/socket.c
+@@ -134,6 +134,7 @@ if_register_socket(struct interface_info *info, int family,
+ 	int sock;
+ 	int flag;
+ 	int domain;
++	int i;
+ #ifdef DHCPv6
+ 	struct sockaddr_in6 *addr6;
+ #endif
+@@ -165,6 +166,18 @@ if_register_socket(struct interface_info *info, int family,
+ 		memcpy(&addr6->sin6_addr,
+ 		       &local_address6, 
+ 		       sizeof(addr6->sin6_addr));
++		/* bind client to link-local address */
++		if (*do_multicast == 0) {
++			for (i=0; i < info->v6address_count; i++) {
++				if (IN6_IS_ADDR_LINKLOCAL(&info->v6addresses[i])) {
++					memcpy(&addr6->sin6_addr,
++					       &info->v6addresses[i],
++					       sizeof(addr6->sin6_addr));
++					addr6->sin6_scope_id = if_nametoindex(info->name);
++					break;
++				}
++			}
++		}
+ #ifdef HAVE_SA_LEN
+ 		addr6->sin6_len = sizeof(*addr6);
+ #endif
+-- 
+1.8.3.1
+
diff --git a/dhcp.spec b/dhcp.spec
index 82b1439..f6c2d41 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.5
-Release:  19%{?dist}
+Release:  20%{?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.
@@ -79,6 +79,7 @@ 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
+Patch49:  dhcp-bind-link-local.patch
 
 BuildRequires: autoconf
 BuildRequires: automake
@@ -343,6 +344,10 @@ rm -rf includes/isc-dhcp
 # (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #33098])
 %patch48 -p1 -b .next-server
 
+# Bind DHCPv6 client to link-local address instead of 0 address (#1001742)
+# (Submitted to dhcp-bugs at isc.org - [ISC-Bugs #34784])
+%patch49 -p1 -b .bind-link-local
+
 # 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
@@ -610,6 +615,9 @@ done
 
 
 %changelog
+* Thu Sep 12 2013 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.5-20
+- bind DHCPv6 client to link-local address instead of 0 address (#1001742)
+
 * Mon Aug 26 2013 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.5-19
 - don't crash on aliased infiniband interface (#996518)
 


More information about the scm-commits mailing list