summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-06-01 06:21:04 +0000
committerRoy Marples <roy@marples.name>2016-06-01 06:21:04 +0000
commitfc8cfb5016583036797dafadb8f8e92b0f7b4de4 (patch)
treed322e89f8eea960e96db96ee1b7192dfa1d29df8
parent4252dbe59241c04c4a76df38260215e065f03473 (diff)
downloaddhcpcd-fc8cfb5016583036797dafadb8f8e92b0f7b4de4.tar.xz
Allow an SLA 0 and prefix length of 0 to delegate the whole prefix which
allows the following config: ia_pd 1 wm1/0
-rw-r--r--dhcp6.c15
1 files changed, 15 insertions, 0 deletions
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;