Update the last lookup time for a neighbor when actually doing a lookup. Also fixed some coding style issues.

This commit is contained in:
nvt 2012-04-22 00:31:56 +02:00
parent 534c734465
commit e4a305d353
2 changed files with 12 additions and 11 deletions

View file

@ -280,7 +280,7 @@ uip_ds6_list_loop(uip_ds6_element_t *list, uint8_t size,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ds6_nbr_t * uip_ds6_nbr_t *
uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t * lladdr, uip_ds6_nbr_add(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr,
uint8_t isrouter, uint8_t state) uint8_t isrouter, uint8_t state)
{ {
int r; int r;
@ -366,6 +366,7 @@ uip_ds6_nbr_lookup(uip_ipaddr_t *ipaddr)
((uip_ds6_element_t *)uip_ds6_nbr_cache, UIP_DS6_NBR_NB, ((uip_ds6_element_t *)uip_ds6_nbr_cache, UIP_DS6_NBR_NB,
sizeof(uip_ds6_nbr_t), ipaddr, 128, sizeof(uip_ds6_nbr_t), ipaddr, 128,
(uip_ds6_element_t **)&locnbr) == FOUND) { (uip_ds6_element_t **)&locnbr) == FOUND) {
locnbr->last_lookup = clock_time();
return locnbr; return locnbr;
} }
return NULL; return NULL;
@ -528,7 +529,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_ds6_prefix_rm(uip_ds6_prefix_t * prefix) uip_ds6_prefix_rm(uip_ds6_prefix_t *prefix)
{ {
if(prefix != NULL) { if(prefix != NULL) {
prefix->isused = 0; prefix->isused = 0;
@ -677,7 +678,7 @@ uip_ds6_maddr_add(uip_ipaddr_t *ipaddr)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_ds6_maddr_rm(uip_ds6_maddr_t * maddr) uip_ds6_maddr_rm(uip_ds6_maddr_t *maddr)
{ {
if(maddr != NULL) { if(maddr != NULL) {
maddr->isused = 0; maddr->isused = 0;
@ -716,7 +717,7 @@ uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_ds6_aaddr_rm(uip_ds6_aaddr_t * aaddr) uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr)
{ {
if(aaddr != NULL) { if(aaddr != NULL) {
aaddr->isused = 0; aaddr->isused = 0;
@ -870,7 +871,7 @@ uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t * lladdr) uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr)
{ {
/* We consider only links with IEEE EUI-64 identifier or /* We consider only links with IEEE EUI-64 identifier or
* IEEE 48-bit MAC addresses */ * IEEE 48-bit MAC addresses */
@ -945,7 +946,7 @@ uip_ds6_dad(uip_ds6_addr_t *addr)
* address can not be used). * address can not be used).
*/ */
int int
uip_ds6_dad_failed(uip_ds6_addr_t * addr) uip_ds6_dad_failed(uip_ds6_addr_t *addr)
{ {
if(uip_is_addr_link_local(&addr->ipaddr)) { if(uip_is_addr_link_local(&addr->ipaddr)) {
PRINTF("Contiki shutdown, DAD for link local address failed\n"); PRINTF("Contiki shutdown, DAD for link local address failed\n");

View file

@ -390,21 +390,21 @@ void uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop);
/** @} */ /** @} */
/** \brief set the last 64 bits of an IP address based on the MAC address */ /** \brief set the last 64 bits of an IP address based on the MAC address */
void uip_ds6_set_addr_iid(uip_ipaddr_t * ipaddr, uip_lladdr_t * lladdr); void uip_ds6_set_addr_iid(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr);
/** \brief Get the number of matching bits of two addresses */ /** \brief Get the number of matching bits of two addresses */
uint8_t get_match_length(uip_ipaddr_t * src, uip_ipaddr_t * dst); uint8_t get_match_length(uip_ipaddr_t *src, uip_ipaddr_t *dst);
#if UIP_ND6_DEF_MAXDADNS >0 #if UIP_ND6_DEF_MAXDADNS >0
/** \brief Perform Duplicate Address Selection on one address */ /** \brief Perform Duplicate Address Selection on one address */
void uip_ds6_dad(uip_ds6_addr_t * ifaddr); void uip_ds6_dad(uip_ds6_addr_t *ifaddr);
/** \brief Callback when DAD failed */ /** \brief Callback when DAD failed */
int uip_ds6_dad_failed(uip_ds6_addr_t * ifaddr); int uip_ds6_dad_failed(uip_ds6_addr_t *ifaddr);
#endif /* UIP_ND6_DEF_MAXDADNS */ #endif /* UIP_ND6_DEF_MAXDADNS */
/** \brief Source address selection, see RFC 3484 */ /** \brief Source address selection, see RFC 3484 */
void uip_ds6_select_src(uip_ipaddr_t * src, uip_ipaddr_t * dst); void uip_ds6_select_src(uip_ipaddr_t *src, uip_ipaddr_t *dst);
#if UIP_CONF_ROUTER #if UIP_CONF_ROUTER
#if UIP_ND6_SEND_RA #if UIP_ND6_SEND_RA