summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-11-30 20:25:45 +0100
committerSteven Barth <steven@midlink.org>2014-11-30 20:25:45 +0100
commit0aff911e92043891dcb5ccd83b721ee748195175 (patch)
tree07dc6ce523ceb428e7909edc90d2a2a0d0ff28d2 /src
parent045d7158852d86a4b190267a252f32c2f15034aa (diff)
downloadodhcp6c-0aff911e92043891dcb5ccd83b721ee748195175.tar.gz
More compatibility with non RFC-compliant servers
Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'src')
-rw-r--r--src/dhcpv6.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index cb2aa76..597d239 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -328,6 +328,11 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
.addr = e[j].target
};
+ if (type == DHCPV6_MSG_REQUEST) {
+ p.preferred = htonl(e[j].preferred);
+ p.valid = htonl(e[j].valid);
+ }
+
memcpy(ia_pd + ia_pd_len, &p, sizeof(p));
ia_pd_len += sizeof(p);
@@ -372,8 +377,14 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
pa[i].type = htons(DHCPV6_OPT_IA_ADDR);
pa[i].len = htons(sizeof(pa[i]) - 4U);
pa[i].addr = e[i].target;
- pa[i].preferred = 0;
- pa[i].valid = 0;
+
+ if (type == DHCPV6_MSG_REQUEST) {
+ pa[i].preferred = htonl(e[i].preferred);
+ pa[i].valid = htonl(e[i].valid);
+ } else {
+ pa[i].preferred = 0;
+ pa[i].valid = 0;
+ }
}
ia_na = pa;