From: Roy Marples Date: Sat, 16 Apr 2016 20:32:11 +0000 (+0000) Subject: If sla is 0, just copy the prefix and don't set a blackhole route if end prefix is... X-Git-Tag: v6.10.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63558f6166e26b9dbc75ca42f4b444d631d3a62c;p=thirdparty%2Fdhcpcd.git If sla is 0, just copy the prefix and don't set a blackhole route if end prefix is the same as the delegated prefix. Fixes [7461677bd0]. --- diff --git a/dhcp6.c b/dhcp6.c index 15c2edaf..79ead712 100644 --- a/dhcp6.c +++ b/dhcp6.c @@ -437,7 +437,7 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct interface *ifp, else { asla.prefix_len = (uint8_t)(prefix->prefix_len + bits); - /* Make a 64 prefix by default, as this maks SLAAC + /* Make a 64 prefix by default, as this makes SLAAC * possible. * Otherwise round up to the nearest 4 bits. */ if (asla.prefix_len <= 64) @@ -455,7 +455,9 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct interface *ifp, prefix->prefix_len); } - if (ipv6_userprefix(&prefix->prefix, prefix->prefix_len, + if (sla->sla == 0) { + *addr = prefix->prefix; + } else if (ipv6_userprefix(&prefix->prefix, prefix->prefix_len, sla->sla, addr, sla->prefix_len) == -1) { sa = inet_ntop(AF_INET6, &prefix->prefix, @@ -2389,6 +2391,11 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv6_addr *prefix, a->prefix = addr; a->prefix_len = (uint8_t)pfxlen; + /* If sla is zero and the prefix length hasn't changed, + * don't install a blackhole route. */ + if (sla->sla_set && sla->sla == 0 && prefix->prefix_len == pfxlen) + prefix->flags |= IPV6_AF_DELEGATEDZERO; + /* Add our suffix */ if (sla->suffix) { a->addr = addr; @@ -2512,9 +2519,6 @@ dhcp6_delegate_prefix(struct interface *ifp) } for (j = 0; j < ia->sla_len; j++) { sla = &ia->sla[j]; - if (sla->sla_set && sla->sla == 0) - ap->flags |= - IPV6_AF_DELEGATEDZERO; if (strcmp(ifd->name, sla->ifname)) continue; if (ifd->carrier != LINK_UP) {