Removed CLOCK_SECOND from stimers in uIPv6, stimers are already in seconds
This commit is contained in:
parent
47a6eb5210
commit
10deaa6fc6
4 changed files with 27 additions and 29 deletions
|
@ -526,7 +526,7 @@ uip_nd6_io_na_input(void)
|
|||
neighbor->state = REACHABLE;
|
||||
/* reachable time is stored in ms*/
|
||||
stimer_set(&(neighbor->reachable),
|
||||
(uip_netif_physical_if.reachable_time / 1000) * CLOCK_SECOND);
|
||||
uip_netif_physical_if.reachable_time / 1000);
|
||||
|
||||
} else {
|
||||
neighbor->state = STALE;
|
||||
|
@ -557,7 +557,7 @@ uip_nd6_io_na_input(void)
|
|||
neighbor->state = REACHABLE;
|
||||
/* reachable time is stored in ms*/
|
||||
stimer_set(&(neighbor->reachable),
|
||||
(uip_netif_physical_if.reachable_time / 1000) * CLOCK_SECOND);
|
||||
uip_netif_physical_if.reachable_time / 1000);
|
||||
|
||||
} else {
|
||||
if(nd6_opt_llao != 0 && is_llchange) {
|
||||
|
@ -760,7 +760,7 @@ uip_nd6_io_ra_input(void) {
|
|||
if((nd6_opt_prefix_info[i])->validlt != UIP_ND6_INFINITE_LIFETIME){
|
||||
prefix = uip_nd6_prefix_add(&(nd6_opt_prefix_info[i])->prefix,
|
||||
(nd6_opt_prefix_info[i])->preflen,
|
||||
ntohl((nd6_opt_prefix_info[i])->validlt)*CLOCK_SECOND);
|
||||
ntohl((nd6_opt_prefix_info[i])->validlt));
|
||||
} else {
|
||||
prefix = uip_nd6_prefix_add(&(nd6_opt_prefix_info[i])->prefix,
|
||||
(nd6_opt_prefix_info[i])->preflen,
|
||||
|
@ -779,8 +779,8 @@ uip_nd6_io_ra_input(void) {
|
|||
default:
|
||||
PRINTF("Updating timer of prefix");
|
||||
PRINT6ADDR(prefix);
|
||||
PRINTF("new value %lu\n", ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND);
|
||||
stimer_set(&prefix->vlifetime, ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND);
|
||||
PRINTF("new value %lu\n", ntohl((nd6_opt_prefix_info[i])->validlt));
|
||||
stimer_set(&prefix->vlifetime, ntohl((nd6_opt_prefix_info[i])->validlt));
|
||||
/*in case the prefix lifetime was previously infinite */
|
||||
prefix->is_infinite = 0;
|
||||
break;
|
||||
|
@ -798,19 +798,17 @@ uip_nd6_io_ra_input(void) {
|
|||
if((nd6_opt_prefix_info[i])->validlt != UIP_ND6_INFINITE_LIFETIME) {
|
||||
/* The processing below is defined in RFC4862 section 5.5.3 e */
|
||||
if((ntohl((nd6_opt_prefix_info[i])->validlt) > 2 * 60 * 60) ||
|
||||
(ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND > stimer_remaining(&ifaddr->vlifetime))) {
|
||||
(ntohl((nd6_opt_prefix_info[i])->validlt)> stimer_remaining(&ifaddr->vlifetime))) {
|
||||
PRINTF("Updating timer of address");
|
||||
PRINT6ADDR(&ifaddr->ipaddr);
|
||||
PRINTF("new value %lu\n", ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND);
|
||||
stimer_set(&ifaddr->vlifetime, ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND);
|
||||
PRINTF("new value %lu\n", ntohl((nd6_opt_prefix_info[i])->validlt));
|
||||
stimer_set(&ifaddr->vlifetime, ntohl((nd6_opt_prefix_info[i])->validlt));
|
||||
} else {
|
||||
/** \TODO below overflows on raven, i.e. when times are on
|
||||
16 bits */
|
||||
stimer_set(&ifaddr->vlifetime, 2 * 60 * 60 * CLOCK_SECOND);
|
||||
stimer_set(&ifaddr->vlifetime, 2 * 60 * 60);
|
||||
|
||||
PRINTF("Updating timer of address ");
|
||||
PRINT6ADDR(&ifaddr->ipaddr);
|
||||
PRINTF("new value %lu\n", (unsigned long)(2 * 60 * 60 * CLOCK_SECOND));
|
||||
PRINTF("new value %lu\n", (unsigned long)(2 * 60 * 60));
|
||||
}
|
||||
/*in case the address lifetime was previously infinite */
|
||||
ifaddr->is_infinite = 0;
|
||||
|
@ -823,7 +821,7 @@ uip_nd6_io_ra_input(void) {
|
|||
/* Add an address with FINITE lifetime */
|
||||
uip_netif_addr_add(&(nd6_opt_prefix_info[i])->prefix,
|
||||
(nd6_opt_prefix_info[i])->preflen,
|
||||
ntohl((nd6_opt_prefix_info[i])->validlt) * CLOCK_SECOND,
|
||||
ntohl((nd6_opt_prefix_info[i])->validlt),
|
||||
AUTOCONF);
|
||||
} else {
|
||||
/* Add an address with INFINITE lifetime */
|
||||
|
@ -883,9 +881,9 @@ uip_nd6_io_ra_input(void) {
|
|||
neighbor->isrouter = 1;
|
||||
}
|
||||
if((router = uip_nd6_defrouter_lookup(neighbor)) == NULL) {
|
||||
uip_nd6_defrouter_add(neighbor, (unsigned long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)) * (CLOCK_SECOND));
|
||||
uip_nd6_defrouter_add(neighbor, (unsigned long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
||||
} else {
|
||||
stimer_set(&(router->lifetime), (unsigned long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)) * CLOCK_SECOND);
|
||||
stimer_set(&(router->lifetime), (unsigned long)(ntohs(UIP_ND6_RA_BUF->router_lifetime)));
|
||||
}
|
||||
} else {
|
||||
/* delete router entry*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue