From e63a2837acfaf54c97a9db466bf485e9f7024fe8 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 19 May 2016 08:54:24 +0200 Subject: Add per-host leasetime support Patch by Daniel Dickinson Signed-off-by: Steven Barth --- src/dhcpv6-ia.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/dhcpv6-ia.c') diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 9b8c479..4c321ac 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -100,6 +100,9 @@ int setup_dhcpv6_ia_interface(struct interface *iface, bool enable) return -1; } + if (lease->dhcpv4_leasetime > 0) + a->leasetime = lease->dhcpv4_leasetime; + a->clid_len = duid_len; a->length = 128; if (lease->hostid) { @@ -675,7 +678,12 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status, datalen += sizeof(stat); } else { if (a) { - uint32_t leasetime = iface->dhcpv4_leasetime; + uint32_t leasetime; + if (a->leasetime > 0) { + leasetime = a->leasetime; + } else { + leasetime = iface->dhcpv4_leasetime; + } if (leasetime == 0) leasetime = 3600; else if (leasetime < 60) -- cgit v1.2.3