Remove unneeded state refresh and set reachable timer upon adding a nbr

This commit is contained in:
Pablo Corbalán 2016-06-12 16:55:48 +01:00
parent 373e5653e6
commit 910f828975
3 changed files with 15 additions and 23 deletions

View file

@ -96,8 +96,12 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
uip_packetqueue_new(&nbr->packethandle); uip_packetqueue_new(&nbr->packethandle);
#endif /* UIP_CONF_IPV6_QUEUE_PKT */ #endif /* UIP_CONF_IPV6_QUEUE_PKT */
#if UIP_ND6_SEND_NA #if UIP_ND6_SEND_NA
/* timers are set separately, for now we put them in expired state */ if(nbr->state == NBR_REACHABLE) {
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
} else {
/* We set the timer in expired state */
stimer_set(&nbr->reachable, 0); stimer_set(&nbr->reachable, 0);
}
stimer_set(&nbr->sendns, 0); stimer_set(&nbr->sendns, 0);
nbr->nscount = 0; nbr->nscount = 0;
#endif /* UIP_ND6_SEND_NA */ #endif /* UIP_ND6_SEND_NA */

View file

@ -522,14 +522,11 @@ na_input(void)
goto discard; goto discard;
} }
if(is_solicited) { /* Note: No need to refresh the state of the nbr here.
nbr->state = NBR_REACHABLE; * It has already been refreshed upon receiving the unicast IPv6 ND packet.
nbr->nscount = 0; * See: uip_ds6_nbr_refresh_reachable_state()
*/
/* reachable time is stored in ms */ if(!is_solicited) {
stimer_set(&(nbr->reachable), uip_ds6_if.reachable_time / 1000);
} else {
nbr->state = NBR_STALE; nbr->state = NBR_STALE;
} }
nbr->isrouter = is_router; nbr->isrouter = is_router;
@ -552,11 +549,10 @@ na_input(void)
goto discard; goto discard;
} }
} }
if(is_solicited) { /* Note: No need to refresh the state of the nbr here.
nbr->state = NBR_REACHABLE; * It has already been refreshed upon receiving the unicast IPv6 ND packet.
/* reachable time is stored in ms */ * See: uip_ds6_nbr_refresh_reachable_state()
stimer_set(&(nbr->reachable), uip_ds6_if.reachable_time / 1000); */
}
} }
} }
if(nbr->isrouter && !is_router) { if(nbr->isrouter && !is_router) {

View file

@ -201,14 +201,6 @@ rpl_icmp6_update_nbr_table(uip_ipaddr_t *from, nbr_table_reason_t reason, void *
} }
} }
if(nbr != NULL) {
#if UIP_ND6_SEND_NA
/* set reachable timer if we added or found the nbr entry - and update
neighbor entry to reachable to avoid sending NS/NA, etc. */
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
nbr->state = NBR_REACHABLE;
#endif /* UIP_ND6_SEND_NA */
}
return nbr; return nbr;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/