dhcpv6-ia: Display infinite lifetime as INT32_MAX in state file
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 17 Nov 2016 15:11:59 +0000 (16:11 +0100)
committerJohn Crispin <john@phrozen.org>
Mon, 21 Nov 2016 10:36:16 +0000 (11:36 +0100)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/dhcpv6-ia.c

index 597bc74981e6f2d2293ff4b1918c933dac5a4870..852af97914a4067fe792948a7c6f2b838fc23364 100644 (file)
@@ -247,7 +247,8 @@ void dhcpv6_write_statefile(void)
                                                        iface->ifname, duidbuf, ntohl(c->iaid),
                                                        (c->hostname ? c->hostname : "-"),
                                                        (unsigned)(c->valid_until > now ?
-                                                                       (c->valid_until - now + wall_time) : 0),
+                                                                       (c->valid_until - now + wall_time) :
+                                                                       (INFINITE_VALID(c->valid_until) ? INT32_MAX: 0)),
                                                        c->assigned, (unsigned)c->length);
 
                                        struct in6_addr addr;
@@ -309,7 +310,8 @@ void dhcpv6_write_statefile(void)
                                                        iface->ifname, duidbuf,
                                                        (c->hostname ? c->hostname : "-"),
                                                        (unsigned)(c->valid_until > now ?
-                                                                       (c->valid_until - now + wall_time) : 0),
+                                                                       (c->valid_until - now + wall_time) :
+                                                                       (INFINITE_VALID(c->valid_until) ? INT32_MAX: 0)),
                                                        c->addr);
 
                                        struct in_addr addr = {htonl(c->addr)};