From 3d8f7d6cdae8f610705c84a75955b22c9eaf23b1 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Sep 17 2013 15:00:19 +0000 Subject: another solution for #1001742 (1005814#c10) --- diff --git a/dhcp-bind-link-local.patch b/dhcp-bind-link-local.patch deleted file mode 100644 index d7f6578..0000000 --- a/dhcp-bind-link-local.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f81438c1a7a4fe921e887f431de63d42c38f8623 Mon Sep 17 00:00:00 2001 -From: Jiri Popelka -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-bindtodevice-inet6.patch b/dhcp-bindtodevice-inet6.patch new file mode 100644 index 0000000..d08cffb --- /dev/null +++ b/dhcp-bindtodevice-inet6.patch @@ -0,0 +1,12 @@ +diff -up dhcp-4.2.5/common/socket.c.bindtodevice_inet6 dhcp-4.2.5/common/socket.c +--- dhcp-4.2.5/common/socket.c.bindtodevice_inet6 2013-09-17 16:47:05.000000000 +0200 ++++ dhcp-4.2.5/common/socket.c 2013-09-17 16:48:18.975997842 +0200 +@@ -245,7 +245,7 @@ if_register_socket(struct interface_info + + #if defined(SO_BINDTODEVICE) + /* Bind this socket to this interface. */ +- if ((local_family != AF_INET6) && (info->ifp != NULL) && ++ if ((*do_multicast == 0) && (info->ifp != NULL) && + setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, + (char *)(info -> ifp), sizeof(*(info -> ifp))) < 0) { + log_fatal("setsockopt: SO_BINDTODEVICE: %m"); diff --git a/dhcp.spec b/dhcp.spec index c0e2196..eff95e0 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -79,7 +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 +Patch49: dhcp-bindtodevice-inet6.patch BuildRequires: autoconf BuildRequires: automake @@ -344,9 +344,9 @@ rm -rf includes/isc-dhcp # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #33098]) %patch48 -p1 -b .next-server -# Bind DHCPv6 client to link-local address instead of 0 address (#1001742) +# dhclient -6: bind socket to interface (#1001742) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #34784]) -%patch49 -p1 -b .bind-link-local +%patch49 -p1 -b .bindtodevice_inet6 # Update paths in all man pages for page in client/dhclient.conf.5 client/dhclient.leases.5 \ @@ -617,6 +617,7 @@ done %changelog * Tue Sep 17 2013 Jiri Popelka - 12:4.2.5-21 - 12-dhcpd: wait a few seconds before restarting services (#1003695) +- another solution for #1001742 (1005814#c10) * Thu Sep 12 2013 Jiri Popelka - 12:4.2.5-20 - bind DHCPv6 client to link-local address instead of 0 address (#1001742)