use leaetime as base for T1 and T2 upper bound
authorSteven Barth <steven@midlink.org>
Tue, 17 Jun 2014 07:59:57 +0000 (09:59 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 17 Jun 2014 07:59:57 +0000 (09:59 +0200)
src/dhcpv6-ia.c

index 3a12114544e780e4f783849731b106deae663097..181973d20328b017523e635c6bff957ef13bb582 100644 (file)
@@ -718,8 +718,14 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
                datalen += sizeof(stat);
        } else {
                if (a) {
-                       uint32_t pref = 3600;
-                       uint32_t valid = 3600;
+                       uint32_t leasetime = iface->dhcpv4_leasetime;
+                       if (leasetime == 0)
+                               leasetime = 3600;
+                       else if (leasetime < 60)
+                               leasetime = 60;
+
+                       uint32_t pref = leasetime;
+                       uint32_t valid = leasetime;
 
                        struct odhcpd_ipaddr *addrs = (a->managed) ? a->managed : iface->ia_addr;
                        size_t addrlen = (a->managed) ? (size_t)a->managed_size : iface->ia_addr_len;