Allow to completely desactivate DAD (useless in route-over LLN as implemented, see http://tools.ietf.org/html/draft-ietf-6lowpan-nd-15#section-8.2)
This commit is contained in:
parent
b0907f0344
commit
6ddd0bb190
4 changed files with 32 additions and 2 deletions
|
@ -148,16 +148,19 @@ uip_ds6_init(void)
|
||||||
void
|
void
|
||||||
uip_ds6_periodic(void)
|
uip_ds6_periodic(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Periodic processing on unicast addresses */
|
/* Periodic processing on unicast addresses */
|
||||||
for(locaddr = uip_ds6_if.addr_list;
|
for(locaddr = uip_ds6_if.addr_list;
|
||||||
locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) {
|
locaddr < uip_ds6_if.addr_list + UIP_DS6_ADDR_NB; locaddr++) {
|
||||||
if(locaddr->isused) {
|
if(locaddr->isused) {
|
||||||
if((!locaddr->isinfinite) && (stimer_expired(&locaddr->vlifetime))) {
|
if((!locaddr->isinfinite) && (stimer_expired(&locaddr->vlifetime))) {
|
||||||
uip_ds6_addr_rm(locaddr);
|
uip_ds6_addr_rm(locaddr);
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
} else if((locaddr->state == ADDR_TENTATIVE)
|
} else if((locaddr->state == ADDR_TENTATIVE)
|
||||||
&& (locaddr->dadnscount <= uip_ds6_if.maxdadns)
|
&& (locaddr->dadnscount <= uip_ds6_if.maxdadns)
|
||||||
&& (timer_expired(&locaddr->dadtimer))) {
|
&& (timer_expired(&locaddr->dadtimer))) {
|
||||||
uip_ds6_dad(locaddr);
|
uip_ds6_dad(locaddr);
|
||||||
|
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,7 +552,6 @@ uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type)
|
||||||
(uip_ds6_element_t **)&locaddr) == FREESPACE) {
|
(uip_ds6_element_t **)&locaddr) == FREESPACE) {
|
||||||
locaddr->isused = 1;
|
locaddr->isused = 1;
|
||||||
uip_ipaddr_copy(&locaddr->ipaddr, ipaddr);
|
uip_ipaddr_copy(&locaddr->ipaddr, ipaddr);
|
||||||
locaddr->state = ADDR_TENTATIVE;
|
|
||||||
locaddr->type = type;
|
locaddr->type = type;
|
||||||
if(vlifetime == 0) {
|
if(vlifetime == 0) {
|
||||||
locaddr->isinfinite = 1;
|
locaddr->isinfinite = 1;
|
||||||
|
@ -557,10 +559,15 @@ uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type)
|
||||||
locaddr->isinfinite = 0;
|
locaddr->isinfinite = 0;
|
||||||
stimer_set(&(locaddr->vlifetime), vlifetime);
|
stimer_set(&(locaddr->vlifetime), vlifetime);
|
||||||
}
|
}
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
|
locaddr->state = ADDR_TENTATIVE;
|
||||||
timer_set(&locaddr->dadtimer,
|
timer_set(&locaddr->dadtimer,
|
||||||
random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY *
|
random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY *
|
||||||
CLOCK_SECOND));
|
CLOCK_SECOND));
|
||||||
locaddr->dadnscount = 0;
|
locaddr->dadnscount = 0;
|
||||||
|
#else /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
|
locaddr->state = ADDR_PREFERRED;
|
||||||
|
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
uip_create_solicited_node(ipaddr, &loc_fipaddr);
|
uip_create_solicited_node(ipaddr, &loc_fipaddr);
|
||||||
uip_ds6_maddr_add(&loc_fipaddr);
|
uip_ds6_maddr_add(&loc_fipaddr);
|
||||||
return locaddr;
|
return locaddr;
|
||||||
|
@ -884,6 +891,7 @@ get_match_length(uip_ipaddr_t *src, uip_ipaddr_t *dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
void
|
void
|
||||||
uip_ds6_dad(uip_ds6_addr_t *addr)
|
uip_ds6_dad(uip_ds6_addr_t *addr)
|
||||||
{
|
{
|
||||||
|
@ -922,10 +930,11 @@ uip_ds6_dad_failed(uip_ds6_addr_t * addr)
|
||||||
uip_ds6_addr_rm(addr);
|
uip_ds6_addr_rm(addr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /*UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
#if UIP_CONF_ROUTER
|
#if UIP_CONF_ROUTER
|
||||||
#if UIP_ND6_SEND_RA
|
#if UIP_ND6_SEND_RA
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
void
|
void
|
||||||
uip_ds6_send_ra_sollicited(void)
|
uip_ds6_send_ra_sollicited(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,8 +209,10 @@ typedef struct uip_ds6_addr {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t isinfinite;
|
uint8_t isinfinite;
|
||||||
struct stimer vlifetime;
|
struct stimer vlifetime;
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
struct timer dadtimer;
|
struct timer dadtimer;
|
||||||
uint8_t dadnscount;
|
uint8_t dadnscount;
|
||||||
|
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
} uip_ds6_addr_t;
|
} uip_ds6_addr_t;
|
||||||
|
|
||||||
/** \brief Anycast address */
|
/** \brief Anycast address */
|
||||||
|
@ -385,11 +387,13 @@ 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
|
||||||
/** \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 */
|
||||||
|
|
||||||
/** \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);
|
||||||
|
|
|
@ -224,6 +224,7 @@ uip_nd6_ns_input(void)
|
||||||
|
|
||||||
addr = uip_ds6_addr_lookup(&UIP_ND6_NS_BUF->tgtipaddr);
|
addr = uip_ds6_addr_lookup(&UIP_ND6_NS_BUF->tgtipaddr);
|
||||||
if(addr != NULL) {
|
if(addr != NULL) {
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
|
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
|
||||||
/* DAD CASE */
|
/* DAD CASE */
|
||||||
#if UIP_CONF_IPV6_CHECKS
|
#if UIP_CONF_IPV6_CHECKS
|
||||||
|
@ -242,6 +243,11 @@ uip_nd6_ns_input(void)
|
||||||
uip_ds6_dad_failed(addr);
|
uip_ds6_dad_failed(addr);
|
||||||
goto discard;
|
goto discard;
|
||||||
}
|
}
|
||||||
|
#else /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
|
if(uip_is_addr_unspecified(&UIP_IP_BUF->srcipaddr)) {
|
||||||
|
/* DAD CASE */
|
||||||
|
goto discard;
|
||||||
|
#endif /* UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
}
|
}
|
||||||
#if UIP_CONF_IPV6_CHECKS
|
#if UIP_CONF_IPV6_CHECKS
|
||||||
if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)) {
|
if(uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr)) {
|
||||||
|
@ -441,9 +447,11 @@ uip_nd6_na_input(void)
|
||||||
addr = uip_ds6_addr_lookup(&UIP_ND6_NA_BUF->tgtipaddr);
|
addr = uip_ds6_addr_lookup(&UIP_ND6_NA_BUF->tgtipaddr);
|
||||||
/* Message processing, including TLLAO if any */
|
/* Message processing, including TLLAO if any */
|
||||||
if(addr != NULL) {
|
if(addr != NULL) {
|
||||||
|
#if UIP_ND6_DEF_MAXDADNS > 0
|
||||||
if(addr->state == ADDR_TENTATIVE) {
|
if(addr->state == ADDR_TENTATIVE) {
|
||||||
uip_ds6_dad_failed(addr);
|
uip_ds6_dad_failed(addr);
|
||||||
}
|
}
|
||||||
|
#endif /*UIP_ND6_DEF_MAXDADNS > 0 */
|
||||||
PRINTF("NA received is bad\n");
|
PRINTF("NA received is bad\n");
|
||||||
goto discard;
|
goto discard;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -57,7 +57,16 @@
|
||||||
#define UIP_ND6_INFINITE_LIFETIME 0xFFFFFFFF
|
#define UIP_ND6_INFINITE_LIFETIME 0xFFFFFFFF
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
#ifndef UIP_CONF_ND6_DEF_MAXDADNS
|
||||||
|
/** \brief Do not try DAD when using EUI-64 as allowed by draft-ietf-6lowpan-nd-15 section 8.2 */
|
||||||
|
#if UIP_CONF_LL_802154
|
||||||
|
#define UIP_ND6_DEF_MAXDADNS 0
|
||||||
|
#else /* UIP_CONF_LL_802154 */
|
||||||
#define UIP_ND6_DEF_MAXDADNS 1
|
#define UIP_ND6_DEF_MAXDADNS 1
|
||||||
|
#endif /* UIP_CONF_LL_802154 */
|
||||||
|
#else /* UIP_CONF_ND6_DEF_MAXDADNS */
|
||||||
|
#define UIP_ND6_DEF_MAXDADNS UIP_CONF_ND6_DEF_MAXDADNS
|
||||||
|
#endif /* UIP_CONF_ND6_DEF_MAXDADNS */
|
||||||
|
|
||||||
/** \name RFC 4861 Host constant */
|
/** \name RFC 4861 Host constant */
|
||||||
/** @{ */
|
/** @{ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue