068952c
From: Roger Shimizu <rosh@debian.org>
068952c
Date: Sun, 6 Sep 2020 14:34:36 +0900
068952c
Subject: Make sla-len config optional
068952c
068952c
Cherry-pick from Fedora:
068952c
https://src.fedoraproject.org/rpms/wide-dhcpv6/blob/master/f/wide-dhcpv6-0008-Make-sla-len-config-optional.patch
068952c
---
068952c
 prefixconf.c | 11 +++++++++++
068952c
 1 file changed, 11 insertions(+)
068952c
068952c
diff --git a/prefixconf.c b/prefixconf.c
068952c
index 15b5417..98d9b77 100644
068952c
--- a/prefixconf.c
068952c
+++ b/prefixconf.c
068952c
@@ -460,6 +460,17 @@ add_ifprefix(siteprefix, prefix, pconf)
fa84285
 	ifpfx->paddr.sin6_len = sizeof(struct sockaddr_in6);
fa84285
 #endif
fa84285
 	ifpfx->paddr.sin6_addr = prefix->addr;
fa84285
+
068952c
+	/*
068952c
+         * dave (bevhost) thinks this should fix it rather than
068952c
+         * generare the error below "invalid prefix length"
068952c
+         * this way the sla-len can be left out of the config file
fa84285
+         * and calculated when the prefix is received
fa84285
+         */
fa84285
+	if (prefix->plen + pconf->ifid_len + pconf->sla_len > 128) {
fa84285
+		pconf->sla_len = 128 - pconf->ifid_len - prefix->plen;
fa84285
+	}
fa84285
+
fa84285
 	ifpfx->plen = prefix->plen + pconf->sla_len;
fa84285
 	/*
fa84285
 	 * XXX: our current implementation assumes ifid len is a multiple of 8