summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2016-12-01 14:24:23 +0100
committerFelix Fietkau <nbd@nbd.name>2016-12-01 14:26:02 +0100
commitbe6c5159a46bf2fb813456e53f217a415743ed4c (patch)
tree0a6564bf52d7f87c4fc43f277bbd2fde64d5a4f6 /src/dhcpv6-ia.c
parent374dc3f13623df58275d9da51637976c34be125d (diff)
dhcpv6-ia: Fix assignment of static DHCPv6 leases
Fix assignment of static DHCPv6 leases which was broken by commit 6c3bc0141dacc88992583d6f2cdc8a360df7422d. At the same time fix lifetime check of existing assignments having a finite lifetime Fixes FS#309 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 8db53b9..f4bf044 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -114,6 +114,8 @@ int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
odhcpd_urandom(a->key, sizeof(a->key));
memcpy(a->clid_data, lease->duid, lease->duid_len);
memcpy(a->mac, lease->mac.ether_addr_octet, sizeof(a->mac));
+ /* Infinite valid */
+ a->valid_until = 0;
// Assign to all interfaces
struct dhcpv6_assignment *c;
@@ -1035,7 +1037,7 @@ ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
if (((c->clid_len == clid_len && !memcmp(c->clid_data, clid_data, clid_len)) ||
(c->clid_len >= clid_len && !c->clid_data[0] && !c->clid_data[1]
&& !memcmp(c->mac, mac, sizeof(mac)))) &&
- (c->iaid == ia->iaid || (!INFINITE_VALID(c->valid_until) && c->valid_until < now)) &&
+ (c->iaid == ia->iaid || INFINITE_VALID(c->valid_until) || now < c->valid_until) &&
((is_pd && c->length <= 64) || (is_na && c->length == 128))) {
a = c;