summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-03-26 00:40:57 +0000
committerRoy Marples <roy@marples.name>2019-03-26 00:40:57 +0000
commit01c95afadf6231ae7dced05537f95995f086f573 (patch)
tree031e84d87155f91b64491faa3e8abc8c1cad31b6
parent97bb60296dc42a29a054ebf9347ac31a7d787393 (diff)
downloaddhcpcd-01c95afadf6231ae7dced05537f95995f086f573.tar.xz
DHCPv6: Allow nooptions dhcp6_unicast to work.
This allows dhcpcd to ignore any server set unicast option which doesn't work.
-rw-r--r--src/dhcp6.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 6e83a70f..cc226787 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -797,8 +797,7 @@ dhcp6_makemessage(struct interface *ifp)
m = state->new;
ml = state->new_len;
}
- unicast = NULL;
- /* Depending on state, get the unicast address */
+
switch(state->state) {
case DH6S_INIT: /* FALLTHROUGH */
case DH6S_DISCOVER:
@@ -806,7 +805,6 @@ dhcp6_makemessage(struct interface *ifp)
break;
case DH6S_REQUEST:
type = DHCP6_REQUEST;
- unicast = dhcp6_findmoption(m, ml, D6_OPTION_UNICAST, &uni_len);
break;
case DH6S_CONFIRM:
type = DHCP6_CONFIRM;
@@ -816,20 +814,33 @@ dhcp6_makemessage(struct interface *ifp)
break;
case DH6S_RENEW:
type = DHCP6_RENEW;
- unicast = dhcp6_findmoption(m, ml, D6_OPTION_UNICAST, &uni_len);
break;
case DH6S_INFORM:
type = DHCP6_INFORMATION_REQ;
break;
case DH6S_RELEASE:
type = DHCP6_RELEASE;
- unicast = dhcp6_findmoption(m, ml, D6_OPTION_UNICAST, &uni_len);
break;
default:
errno = EINVAL;
return -1;
}
+ switch(state->state) {
+ case DH6S_REQUEST: /* FALLTHROUGH */
+ case DH6S_RENEW: /* FALLTHROUGH */
+ case DH6S_RELEASE:
+ if (has_option_mask(ifo->nomask6, D6_OPTION_UNICAST)) {
+ unicast = NULL;
+ break;
+ }
+ unicast = dhcp6_findmoption(m, ml, D6_OPTION_UNICAST, &uni_len);
+ break;
+ default:
+ unicast = NULL;
+ break;
+ }
+
/* In non master mode we listen and send from fixed addresses.
* We should try and match an address we have to unicast to,
* but for now this is the safest policy. */