Refresh nbr reachable state after received IPv6 unicast message

This commit is contained in:
Pablo Corbalán 2015-11-26 00:07:58 +00:00
parent 80e4ca7802
commit 0fb47d0a2d
3 changed files with 34 additions and 0 deletions

View file

@ -322,6 +322,20 @@ uip_ds6_neighbor_periodic(void)
}
}
/*---------------------------------------------------------------------------*/
#if UIP_ND6_SEND_NA
void
uip_ds6_nbr_refresh_reachable_state(const uip_ipaddr_t *ipaddr)
{
uip_ds6_nbr_t *nbr;
nbr = uip_ds6_nbr_lookup(ipaddr);
if(nbr != NULL) {
nbr->state = NBR_REACHABLE;
nbr->nscount = 0;
stimer_set(&nbr->reachable, UIP_ND6_REACHABLE_TIME / 1000);
}
}
#endif /* UIP_ND6_SEND_NA */
/*---------------------------------------------------------------------------*/
uip_ds6_nbr_t *
uip_ds6_get_least_lifetime_neighbor(void)
{

View file

@ -100,6 +100,17 @@ void uip_ds6_link_neighbor_callback(int status, int numtx);
void uip_ds6_neighbor_periodic(void);
int uip_ds6_nbr_num(void);
#if UIP_ND6_SEND_NA
/**
* \brief Refresh the reachable state of a neighbor. This function
* may be called when a node receives an IPv6 message that confirms the
* reachability of a neighbor.
* \param ipaddr pointer to the IPv6 address whose neighbor reachability state
* should be refreshed.
*/
void uip_ds6_nbr_refresh_reachable_state(const uip_ipaddr_t *ipaddr);
#endif /* UIP_ND6_SEND_NA */
/**
* \brief
* This searches inside the neighbor table for the neighbor that is about to

View file

@ -84,6 +84,10 @@
#include "rpl/rpl-private.h"
#endif
#if UIP_ND6_SEND_NA
#include "net/ipv6/uip-ds6-nbr.h"
#endif /* UIP_ND6_SEND_NA */
#include <string.h>
/*---------------------------------------------------------------------------*/
@ -1150,6 +1154,11 @@ uip_process(uint8_t flag)
goto drop;
}
/* Refresh neighbor state after receiving a unicast message */
#if UIP_ND6_SEND_NA
uip_ds6_nbr_refresh_reachable_state(&UIP_IP_BUF->srcipaddr);
#endif /* UIP_ND6_SEND_NA */
#if UIP_CONF_ROUTER
/*
* Next header field processing. In IPv6, we can have extension headers,