From: Roy Marples Date: Wed, 1 Jun 2016 06:21:04 +0000 (+0000) Subject: Allow an SLA 0 and prefix length of 0 to delegate the whole prefix which X-Git-Tag: v6.11.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc8cfb5016583036797dafadb8f8e92b0f7b4de4;p=thirdparty%2Fdhcpcd.git Allow an SLA 0 and prefix length of 0 to delegate the whole prefix which allows the following config: ia_pd 1 wm1/0 --- diff --git a/dhcp6.c b/dhcp6.c index aa6d3ce4..e1e332cd 100644 --- 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;