changeset 2543:8255dad7230c draft

You can't request a prefix length with for a normal address. You can't request a specific temporary address.
author Roy Marples <roy@marples.name>
date Sat, 21 Jun 2014 12:45:55 +0000
parents 28b1ed6d98ad
children 995e4986ff30
files dhcp6.c dhcpcd.conf.5.in if-options.c
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp6.c	Sat Jun 21 11:42:36 2014 +0000
+++ b/dhcp6.c	Sat Jun 21 12:45:55 2014 +0000
@@ -1021,7 +1021,9 @@
 	/* Add any requested prefixes / addresses */
 	for (i = 0; i < ifp->options->ia_len; i++) {
 		ia = &ifp->options->ia[i];
-		if (ia->prefix_len) {
+		if (!IN6_IS_ADDR_UNSPECIFIED(&ia->addr) ||
+		    (ia->prefix_len && ifp->options->ia_type == D6_OPTION_IA_PD))
+		{
 			a = calloc(1, sizeof(*a));
 			if (a == NULL) {
 				syslog(LOG_ERR, "%s: %m", __func__);
@@ -1033,11 +1035,11 @@
 			memcpy(&a->iaid, &ia->iaid, sizeof(a->iaid));
 			//a->prefix_pltime = 0;
 			//a->prefix_vltime = 0;
-			if (ifp->options->ia_type == D6_OPTION_IA_PD)
+			if (ifp->options->ia_type == D6_OPTION_IA_PD) {
 				memcpy(&a->prefix, &ia->addr, sizeof(a->addr));
-			else
+				a->prefix_len = ia->prefix_len;
+			} else
 				memcpy(&a->addr, &ia->addr, sizeof(a->addr));
-			a->prefix_len = ia->prefix_len;
 			TAILQ_INSERT_TAIL(&state->addrs, a, next);
 		}
 	}
--- a/dhcpcd.conf.5.in	Sat Jun 21 11:42:36 2014 +0000
+++ b/dhcpcd.conf.5.in	Sat Jun 21 12:45:55 2014 +0000
@@ -214,7 +214,7 @@
 Also, see the
 .Ic env
 option above to control how the hostname is set on the host.
-.It Ic ia_na Op Ar iaid Op / address Op / prefix_len
+.It Ic ia_na Op Ar iaid Op / address
 Request a DHCPv6 Normal Address for
 .Ar iaid .
 .Ar iaid
--- a/if-options.c	Sat Jun 21 11:42:36 2014 +0000
+++ b/if-options.c	Sat Jun 21 12:45:55 2014 +0000
@@ -1265,7 +1265,7 @@
 			ia->iaid[1] = iaid[1];
 			ia->iaid[2] = iaid[2];
 			ia->iaid[3] = iaid[3];
-			if (p == NULL) {
+			if (p == NULL || ifo->ia_type == D6_OPTION_IA_TA) {
 				memset(&ia->addr, 0, sizeof(ia->addr));
 				ia->prefix_len = 0;
 			} else {
@@ -1277,7 +1277,7 @@
 					syslog(LOG_ERR, "%s: %m", arg);
 					memset(&ia->addr, 0, sizeof(ia->addr));
 				}
-				if (p) {
+				if (p && ifo->ia_type == D6_OPTION_IA_PD) {
 					i = atoint(p);
 					if (i != -1 && (i < 8 || i > 120)) {
 						errno = EINVAL;