]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If sla is 0, just copy the prefix and don't set a blackhole route if end prefix is...
authorRoy Marples <roy@marples.name>
Sat, 16 Apr 2016 20:32:11 +0000 (20:32 +0000)
committerRoy Marples <roy@marples.name>
Sat, 16 Apr 2016 20:32:11 +0000 (20:32 +0000)
dhcp6.c

diff --git a/dhcp6.c b/dhcp6.c
index 15c2edaf8a73df596973ac3270c1ace06592c9cd..79ead71247871d62ca8d27dc1cdce2f715670c30 100644 (file)
--- 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) {