diff options
author | Steven Barth <stbarth@cisco.com> | 2016-05-19 08:54:24 +0200 |
---|---|---|
committer | Steven Barth <stbarth@cisco.com> | 2016-05-19 08:54:24 +0200 |
commit | e63a2837acfaf54c97a9db466bf485e9f7024fe8 (patch) | |
tree | 1a73d72c653da69905a68042d77241e83a778747 /src/dhcpv6-ia.c | |
parent | 1fcf0388078c7675187ff4f2f644aaf65138f261 (diff) |
Add per-host leasetime support
Patch by Daniel Dickinson
Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r-- | src/dhcpv6-ia.c | 10 |
1 files changed, 9 insertions, 1 deletions
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) |