summaryrefslogtreecommitdiffstats
path: root/src/ipv6.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-12-16 16:56:17 +0000
committerRoy Marples <roy@marples.name>2019-12-16 17:00:09 +0000
commit2a4a33e81feb7f0d6c735fb3abaa40310a925032 (patch)
tree95dd78b34829c1add78b1c7eb9a4ba94729d47ae /src/ipv6.c
parent32a223e696617292c9047f56567aeb38d256a329 (diff)
downloaddhcpcd-2a4a33e81feb7f0d6c735fb3abaa40310a925032.tar.xz
DHCP6: Fix deprecating a delegated prefix
Be sure to remove the address using the right TAILQ member. While here, simplify the initialisation of pd_pfxs.
Diffstat (limited to 'src/ipv6.c')
-rw-r--r--src/ipv6.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ipv6.c b/src/ipv6.c
index 8d77f2b8..f19f33de 100644
--- a/src/ipv6.c
+++ b/src/ipv6.c
@@ -946,8 +946,17 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs)
if (ap->flags & IPV6_AF_REQUEST) {
ap->flags &= ~IPV6_AF_ADDED;
} else {
- TAILQ_REMOVE(addrs, ap, next);
- ipv6_freeaddr(ap);
+#ifndef SMALL
+ if (ap->delegating_prefix != NULL &&
+ addrs == &ap->delegating_prefix->pd_pfxs) {
+ TAILQ_REMOVE(addrs, ap, pd_next);
+ ap->delegating_prefix = NULL;
+ } else
+#endif
+ {
+ TAILQ_REMOVE(addrs, ap, next);
+ ipv6_freeaddr(ap);
+ }
}
} else if (!(ap->flags & IPV6_AF_STALE) &&
!IN6_IS_ADDR_UNSPECIFIED(&ap->addr))
@@ -1547,6 +1556,10 @@ ipv6_newaddr(struct interface *ifp, const struct in6_addr *addr,
ia->prefix_len = prefix_len;
ia->dhcp6_fd = -1;
+#ifndef SMALL
+ TAILQ_INIT(&ia->pd_pfxs);
+#endif
+
#ifdef IPV6_AF_TEMPORARY
tempaddr = ia->flags & IPV6_AF_TEMPORARY;
#else