]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
You can't request a prefix length with for a normal address.
authorRoy Marples <roy@marples.name>
Sat, 21 Jun 2014 12:45:55 +0000 (12:45 +0000)
committerRoy Marples <roy@marples.name>
Sat, 21 Jun 2014 12:45:55 +0000 (12:45 +0000)
You can't request a specific temporary address.

dhcp6.c
dhcpcd.conf.5.in
if-options.c

diff --git a/dhcp6.c b/dhcp6.c
index 96fcd417c06c13fbb5ba734f050f2c9d855817aa..6ef106ffa996d7b431d4a3f81358cb2a22f3e397 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -1021,7 +1021,9 @@ dhcp6_startdiscover(void *arg)
        /* 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 @@ dhcp6_startdiscover(void *arg)
                        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);
                }
        }
index d755e678b0125d33b441003433e06610c79343c0..fa74e64fa4f2b884a6dc49a63643ee464e093136 100644 (file)
@@ -214,7 +214,7 @@ DNS if the domain part does not match theirs.
 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
index dec0f46dfa6f0715e198a49d263a37b1554bda34..77593a3360c7cf6fcdef37c9b2e3f0d838a9836d 100644 (file)
@@ -1265,7 +1265,7 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                        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 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                                        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;