]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow an SLA 0 and prefix length of 0 to delegate the whole prefix which
authorRoy Marples <roy@marples.name>
Wed, 1 Jun 2016 06:21:04 +0000 (06:21 +0000)
committerRoy Marples <roy@marples.name>
Wed, 1 Jun 2016 06:21:04 +0000 (06:21 +0000)
allows the following config:
ia_pd 1 wm1/0

dhcp6.c

diff --git a/dhcp6.c b/dhcp6.c
index aa6d3ce400a63a1fdfc50034e32c3c512869da5d..e1e332cd5c96cd5e157d0975428dd4054084bdcc 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -401,14 +401,29 @@ dhcp6_delegateaddr(struct in6_addr *addr, struct interface *ifp,
        }
 
        if (sla == NULL || sla->sla_set == 0) {
+               /* No SLA set, so make an assumption of
+                * desired SLA and prefix length. */
                asla.sla = ifp->index;
                asla.prefix_len = 0;
+               asla.sla_set = 0;
+               sla = &asla;
+       } else if (sla->sla == 0 && sla->prefix_len == 0) {
+               /* An SLA of 0 was set with no prefix length specified.
+                * This means we delegate the whole prefix. */
+               asla.sla = sla->sla;
+               asla.prefix_len = prefix->prefix_len;
+               asla.sla_set = 0;
                sla = &asla;
        } else if (sla->prefix_len == 0) {
+               /* An SLA was given, but prefix length was not.
+                * We need to work out a suitable prefix length for
+                * potentially more than one interface. */
                asla.sla = sla->sla;
                asla.prefix_len = 0;
+               asla.sla_set = 0;
                sla = &asla;
        }
+
        if (sla->prefix_len == 0) {
                uint32_t sla_max;
                int bits;