diff options
author | Steven Barth <steven@midlink.org> | 2015-04-06 12:47:28 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2015-04-06 12:47:28 +0200 |
commit | 9bdbc5a4be1ab75145431bc728159a55c723e2ca (patch) | |
tree | 1cff2feb1bb17746fa13abd3d026de802689ec47 /src/dhcpv6-ia.c | |
parent | 73a7133b6e42edc218da5b8011c580ed48c7731a (diff) |
dhcpv6: fix handling of infinite lifetimes
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r-- | src/dhcpv6-ia.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 74e3441..de44581 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -728,13 +728,19 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status, m = i; for (size_t i = 0; i < addrlen; ++i) { - uint32_t prefix_pref = addrs[i].preferred - now; - uint32_t prefix_valid = addrs[i].valid - now; + uint32_t prefix_pref = addrs[i].preferred; + uint32_t prefix_valid = addrs[i].valid; if (addrs[i].prefix > 96 || addrs[i].preferred <= (uint32_t)now) continue; + if (prefix_pref != UINT32_MAX) + prefix_pref -= now; + + if (prefix_valid != UINT32_MAX) + prefix_valid -= now; + if (a->length < 128) { struct dhcpv6_ia_prefix p = { .type = htons(DHCPV6_OPT_IA_PREFIX), |