Merge pull request #16679 from kfessel/p-dhcp-mrd
dhcpv6_client: mrd calculation fixed
This commit is contained in:
commit
e3b52ff08d
@ -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();
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "net/gnrc/rpl.h"
|
||||
#include "net/sock.h"
|
||||
#include "timex.h"
|
||||
#include "evtimer.h"
|
||||
|
||||
#include "net/dhcpv6/client.h"
|
||||
|
||||
@ -183,13 +184,14 @@ uint32_t dhcpv6_client_prefix_valid_until(unsigned netif,
|
||||
gnrc_ipv6_nib_pl_t ple;
|
||||
void *state = NULL;
|
||||
uint32_t max_valid = 0;
|
||||
uint32_t now = evtimer_now_msec();
|
||||
|
||||
while (gnrc_ipv6_nib_pl_iter(netif, &state, &ple)) {
|
||||
if ((ple.pfx_len == pfx_len) &&
|
||||
((ple.valid_until / MS_PER_SEC) > max_valid) &&
|
||||
(((ple.valid_until - now) / MS_PER_SEC) > max_valid) &&
|
||||
(ipv6_addr_match_prefix(&ple.pfx,
|
||||
pfx) >= ple.pfx_len)) {
|
||||
max_valid = ple.valid_until / MS_PER_SEC;
|
||||
max_valid = (ple.valid_until - now) / MS_PER_SEC;
|
||||
}
|
||||
}
|
||||
return max_valid;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user