gnrc_dhcpv6_client: dhcp-helper-function return valid seconds left
dhcpv6_client_prefix_valid_until returned the valid timestamp this fixes it according to the documentation given in /sys/include/net/dhcpv6/client.h to return seconds left
This commit is contained in:
parent
fc1bd005de
commit
fe9a6d7d84
@ -25,6 +25,7 @@
|
|||||||
#include "net/gnrc/rpl.h"
|
#include "net/gnrc/rpl.h"
|
||||||
#include "net/sock.h"
|
#include "net/sock.h"
|
||||||
#include "timex.h"
|
#include "timex.h"
|
||||||
|
#include "evtimer.h"
|
||||||
|
|
||||||
#include "net/dhcpv6/client.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;
|
gnrc_ipv6_nib_pl_t ple;
|
||||||
void *state = NULL;
|
void *state = NULL;
|
||||||
uint32_t max_valid = 0;
|
uint32_t max_valid = 0;
|
||||||
|
uint32_t now = evtimer_now_msec();
|
||||||
|
|
||||||
while (gnrc_ipv6_nib_pl_iter(netif, &state, &ple)) {
|
while (gnrc_ipv6_nib_pl_iter(netif, &state, &ple)) {
|
||||||
if ((ple.pfx_len == pfx_len) &&
|
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,
|
(ipv6_addr_match_prefix(&ple.pfx,
|
||||||
pfx) >= ple.pfx_len)) {
|
pfx) >= ple.pfx_len)) {
|
||||||
max_valid = ple.valid_until / MS_PER_SEC;
|
max_valid = (ple.valid_until - now) / MS_PER_SEC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max_valid;
|
return max_valid;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user