diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2020-01-14 21:16:48 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2020-01-16 20:29:53 +0100 |
commit | 6db312a698e920ff61505ef1f42469880829774d (patch) | |
tree | d127942181b46c8c4efc6ff7dcc63acbef6731c7 /src/router.c | |
parent | 2520c483781339f6c7feae617b7e5c0137e3534d (diff) |
dhcpv6-ia: use dhcp leasetime to set preferred/valid statefull lifetimes
Allow to set the preferred/valid lifetimes of IA_NA/IA_PD options based
on the configured dhcp leasetime.
DHCP leqasetime will be used to set the preferred/valid lifetimes in the
IA_NA/IA_PD options unless the preferred/valid lifetimes of the IPv6
address are smaller then the DHCP leasetime.
This will avoid IA_NA/IA_PD options being sent with infinite lifetimes
due to the IPv6 address having infinite preferred/valid lifetimes
like IPv6 ULA addresses.
While at it rename dhcpv4_leasetime into dhcp_leasetime as the leasetime
is used both for DHCPv4 and DHCPv6
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/router.c')
-rw-r--r-- | src/router.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/router.c b/src/router.c index 7c97672..295bdfb 100644 --- a/src/router.c +++ b/src/router.c @@ -552,13 +552,13 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr preferred = TIME_LEFT(addr->preferred, now); if (iface->ra_useleasetime && - preferred > iface->dhcpv4_leasetime) - preferred = iface->dhcpv4_leasetime; + preferred > iface->dhcp_leasetime) + preferred = iface->dhcp_leasetime; } valid = TIME_LEFT(addr->valid, now); - if (iface->ra_useleasetime && valid > iface->dhcpv4_leasetime) - valid = iface->dhcpv4_leasetime; + if (iface->ra_useleasetime && valid > iface->dhcp_leasetime) + valid = iface->dhcp_leasetime; if (minvalid > valid) minvalid = valid; |