summaryrefslogtreecommitdiffstats
path: root/src/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-08-28 23:43:19 +0100
committerRoy Marples <roy@marples.name>2017-09-09 23:49:11 +0100
commit55f765b0cfa26835ea4739cb68f273875dd208db (patch)
tree7e4bdc0c732b3e64051ea3c7e90a865fb6bff91a /src/ipv6.c
parent03e4b0ec893f32acebcc2324a1cc608e2782f020 (diff)
downloaddhcpcd-55f765b0cfa26835ea4739cb68f273875dd208db.tar.xz
dhcp6: listen to each DHCP address for messages
Summary: This allows dhcpcd to receive unicast DHCPv6 messages to non LL addresses in non master mode. Fixes T123. Test Plan: * Setup your DHCPv6 server to send the unicast option * Start dhcpcd for a specific interface * Watch it ask for confirmation and receive replies to messages Maniphest Tasks: T123 Differential Revision: https://dev.marples.name/D127
Diffstat (limited to 'src/ipv6.c')
-rw-r--r--src/ipv6.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ipv6.c b/src/ipv6.c
index 634fd64b..c62ee610 100644
--- a/src/ipv6.c
+++ b/src/ipv6.c
@@ -973,6 +973,11 @@ ipv6_freeaddr(struct ipv6_addr *ia)
}
#endif
+ if (ia->dhcp6_fd != -1) {
+ close(ia->dhcp6_fd);
+ eloop_event_delete(ia->iface->ctx->eloop, ia->dhcp6_fd);
+ }
+
eloop_q_timeout_delete(ia->iface->ctx->eloop, 0, NULL, ia);
free(ia);
}
@@ -1456,6 +1461,15 @@ ipv6_newaddr(struct interface *ifp, struct in6_addr *addr, uint8_t prefix_len,
char buf[INET6_ADDRSTRLEN];
const char *cbp;
bool tempaddr;
+ int addr_flags;
+
+ /* If adding a new DHCP / RA derived address, check current flags
+ * from an existing address. */
+ ia = ipv6_iffindaddr(ifp, addr, 0);
+ if (ia != NULL)
+ addr_flags = ia->addr_flags;
+ else
+ addr_flags = IN6_IFF_TENTATIVE;
ia = calloc(1, sizeof(*ia));
if (ia == NULL)
@@ -1463,8 +1477,9 @@ ipv6_newaddr(struct interface *ifp, struct in6_addr *addr, uint8_t prefix_len,
ia->iface = ifp;
ia->flags = IPV6_AF_NEW | flags;
- ia->addr_flags = IN6_IFF_TENTATIVE;
+ ia->addr_flags = addr_flags;
ia->prefix_len = prefix_len;
+ ia->dhcp6_fd = -1;
#ifdef IPV6_AF_TEMPORARY
tempaddr = ia->flags & IPV6_AF_TEMPORARY;