summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2020-04-02 21:26:57 +0200
committerHans Dedecker <dedeckeh@gmail.com>2020-04-04 20:53:43 +0200
commitf61964c66be050716089d31f13688c1ab382f0b7 (patch)
tree057fbd4fa9dd0de35f4f029f9b7c747a4e0d7c8b /src/dhcpv6-ia.c
parentfbf14aee4ad321ac3702b60ff8193d82812c2270 (diff)
dhcpv6-ia: fix preferred and valid lifetimes in ubus ipv6leases
Since commit 6db312a698e920ff61505ef1f42469880829774d the preferred and valid lifetimes of the addresses/prefixes is based on the configured leasetime; as a result the displayed preferred and valid lifetimes need to be calculated based on the assignment lifetime as this is set to the lowest valid lifetime of the addresses/prefixes. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index b51649c..38a901b 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -247,9 +247,15 @@ void dhcpv6_ia_enum_addrs(struct interface *iface, struct dhcp_assignment *c,
addr.s6_addr32[2] = addr.s6_addr32[3] = 0;
}
+ if (pref > (uint32_t)c->valid_until)
+ pref = c->valid_until;
+
if (pref != UINT32_MAX)
pref -= now;
+ if (valid > (uint32_t)c->valid_until)
+ valid = c->valid_until;
+
if (valid != UINT32_MAX)
valid -= now;