summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-02-19 22:00:38 +0100
committerHans Dedecker <dedeckeh@gmail.com>2017-02-19 22:15:57 +0100
commite437ce9422c2f92752be5b6b3fd453e099a98a7e (patch)
treed9a87c78ad54ad215c6bfb9210f73cd2c1d0a3a7 /src/dhcpv6-ia.c
parent942fb33d3017e8769a7354ee008daf0f31a40fe2 (diff)
treewide: simplify dhcp leasetime checking
Set dhcp leasetim to 43200 seconds for all interfaces independant if dhcpv4 is enabled for an interface. Minimum allowed leasetime is 60 seconds when parsing leastime configuration; this allows to clean up the awkward leasetime checks on different places in the code Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 84f368e..888634f 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -88,8 +88,7 @@ int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
return -1;
}
- if (lease->dhcpv4_leasetime > 0)
- a->leasetime = lease->dhcpv4_leasetime;
+ a->leasetime = lease->dhcpv4_leasetime;
a->clid_len = duid_len;
a->length = 128;
@@ -719,16 +718,11 @@ static size_t append_reply(uint8_t *buf, size_t buflen, uint16_t status,
} else {
if (a) {
uint32_t leasetime;
- if (a->leasetime > 0)
+ if (a->leasetime)
leasetime = a->leasetime;
else
leasetime = iface->dhcpv4_leasetime;
- if (leasetime == 0)
- leasetime = 3600;
- else if (leasetime < 60)
- leasetime = 60;
-
uint32_t pref = leasetime;
uint32_t valid = leasetime;