57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
From f81438c1a7a4fe921e887f431de63d42c38f8623 Mon Sep 17 00:00:00 2001
|
|
From: Jiri Popelka <jpopelka@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
|
|
|