summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-06-17 09:59:57 +0200
committerSteven Barth <steven@midlink.org>2014-06-17 09:59:57 +0200
commit72082d2f6c2ee568470575c09ba4984f1a5c44f0 (patch)
treec0d335b47c5191da0fbff6b10258d48002f0b54a /src/dhcpv6-ia.c
parentec3320078c11474b8ea48225f330c15d9471e312 (diff)
use leaetime as base for T1 and T2 upper bound
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 3a12114..181973d 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -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;