]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow a suffix of 0 to mean a slaac style PD address.
authorRoy Marples <roy@marples.name>
Fri, 29 Jan 2016 12:01:21 +0000 (12:01 +0000)
committerRoy Marples <roy@marples.name>
Fri, 29 Jan 2016 12:01:21 +0000 (12:01 +0000)
dhcp6.c
dhcpcd.conf.5.in

diff --git a/dhcp6.c b/dhcp6.c
index 88fe4f6f1c43596604c80621a68192808b5125d1..0e6b958b2d4d38abbdc1c2d02b6f83fa405fb578 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -2379,10 +2379,22 @@ dhcp6_ifdelegateaddr(struct interface *ifp, struct ipv6_addr *prefix,
        a->prefix_len = (uint8_t)pfxlen;
 
        /* Add our suffix */
-       a->addr = addr;
-       vl = be64dec(addr.s6_addr + 8);
-       vl |= sla->suffix;
-       be64enc(a->addr.s6_addr + 8, vl);
+       if (sla->suffix) {
+               a->addr = addr;
+               vl = be64dec(addr.s6_addr + 8);
+               vl |= sla->suffix;
+               be64enc(a->addr.s6_addr + 8, vl);
+       } else {
+               a->dadcounter = ipv6_makeaddr(&a->addr, ifp,
+                   &a->prefix, a->prefix_len);
+               if (a->dadcounter == -1) {
+                       logger(ifp->ctx, LOG_ERR,
+                           "%s: error adding slaac to prefix_len %d",
+                           ifp->name, a->prefix_len);
+                       free(a);
+                       return NULL;
+               }
+       }
 
        state = D6_STATE(ifp);
        /* Remove any exiting address */
index 35dd8069eeea46caa333b5af2569af6b91282c5a..024a2a82cf6b92d3543d2c5142474653dea9f92b 100644 (file)
@@ -276,6 +276,9 @@ and
 Each assigned address will have a
 .Ar suffix ,
 defaulting to 1.
+If the
+.Ar suffix
+is 0 then a slaac address is assigned.
 You cannot assign a prefix to the requesting interface unless the
 DHCPv6 server supports
 .Li RFC6603