From: Hans Dedecker Date: Mon, 2 Jan 2017 16:10:14 +0000 (+0100) Subject: dhcpv6-ia: update valid_until only for non static DHCPv6 leases X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=commitdiff_plain;h=561890e1ce8aa467a83db5f05e563a00d4d9aa47;hp=0b45fce0859e4726e27f408016ef2f7d210c847f dhcpv6-ia: update valid_until only for non static DHCPv6 leases Update valid_until lifetime only for non static DHCPv6 leases otherwise the lifetime of a static lease is not infinite anymore Signed-off-by: Hans Dedecker --- diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index df69759..c8786c3 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -450,7 +450,7 @@ static void managed_handle_pd_data(struct ustream *s, _unused int bytes_new) if (first && c->managed_size == 0) free_dhcpv6_assignment(c); - else if (first) + else if (first & !(c->flags & OAF_STATIC)) c->valid_until = now + 150; } @@ -460,7 +460,9 @@ static void managed_handle_pd_done(struct ustream *s) { struct dhcpv6_assignment *c = container_of(s, struct dhcpv6_assignment, managed_sock); - c->valid_until = odhcpd_time() + 15; + if (!(c->flags & OAF_STATIC)) + c->valid_until = odhcpd_time() + 15; + c->managed_size = 0; if (c->accept_reconf) @@ -484,7 +486,10 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign) iaidbuf, assign->iaid, assign->length); ustream_write_pending(&assign->managed_sock.stream); assign->managed_size = -1; - assign->valid_until = odhcpd_time() + 15; + + if (!(assign->flags & OAF_STATIC)) + assign->valid_until = odhcpd_time() + 15; + list_add(&assign->head, &iface->ia_assignments); /* Wait initial period of up to 250ms for immediate assignment */