uip-ds6-nbr: consider reachable node if LL-NUD

The reachable state might also be considered to keep the reachable
state since we are already not standard complaint. This reduces the
nbr discovery messages if nodes talk to each other periodically.
This commit is contained in:
Víctor Ariño 2014-10-27 11:57:49 +01:00 committed by lebrush
parent 6fb7dd238e
commit 0f394b220b

View file

@ -201,12 +201,25 @@ uip_ds6_link_neighbor_callback(int status, int numtx)
LINK_NEIGHBOR_CALLBACK(dest, status, numtx); LINK_NEIGHBOR_CALLBACK(dest, status, numtx);
#if UIP_DS6_LL_NUD #if UIP_DS6_LL_NUD
/* From RFC4861, page 72, last paragraph of section 7.3.3:
*
* "In some cases, link-specific information may indicate that a path to
* a neighbor has failed (e.g., the resetting of a virtual circuit). In
* such cases, link-specific information may be used to purge Neighbor
* Cache entries before the Neighbor Unreachability Detection would do
* so. However, link-specific information MUST NOT be used to confirm
* the reachability of a neighbor; such information does not provide
* end-to-end confirmation between neighboring IP layers."
*
* However, we assume that receiving a link layer ack ensures the delivery
* of the transmitted packed to the IP stack of the neighbour. This is a
* fair assumption and allows battery powered nodes save some battery by
* not re-testing the state of a neighbour periodically if it
* acknowledges link packets. */
if(status == MAC_TX_OK) { if(status == MAC_TX_OK) {
uip_ds6_nbr_t *nbr; uip_ds6_nbr_t *nbr;
nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest); nbr = uip_ds6_nbr_ll_lookup((uip_lladdr_t *)dest);
if(nbr != NULL && if(nbr != NULL && nbr->state != NBR_INCOMPLETE) {
(nbr->state == NBR_STALE || nbr->state == NBR_DELAY ||
nbr->state == NBR_PROBE)) {
nbr->state = NBR_REACHABLE; nbr->state = NBR_REACHABLE;
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000); stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
PRINTF("uip-ds6-neighbor : received a link layer ACK : "); PRINTF("uip-ds6-neighbor : received a link layer ACK : ");