dhcpv6_client: mrd calculation fixed for renew and rebind

mrd calculation for dhcp-renew was wrong this fixes it
and the logic for dhcp rebind mrd handling
    (try rebind if ther is mrd)
see issue  #16677
This commit is contained in:
Karl Fessel 2021-07-23 17:46:14 +02:00
parent fe9a6d7d84
commit 238c759899

View File

@ -839,7 +839,7 @@ static void _request_renew_rebind(uint8_t type)
case DHCPV6_RENEW:
irt = DHCPV6_REN_TIMEOUT;
mrt = DHCPV6_REN_MAX_RT;
mrd = rebind_time - t2;
mrd = rebind_time - _now_sec();
break;
case DHCPV6_REBIND: {
irt = DHCPV6_REB_TIMEOUT;
@ -858,7 +858,7 @@ static void _request_renew_rebind(uint8_t type)
mrd = valid_until;
}
}
if (mrd > 0) {
if (mrd == 0) {
/* all leases already expired, don't try to rebind and
* solicit immediately */
_post_solicit_servers();