Merge pull request #291 from simonduq/na-config
Added a flag to optionally disable IPv6 NA/NS at compile time
This commit is contained in:
commit
f8edf41411
@ -602,6 +602,7 @@ tcpip_ipv6_output(void)
|
||||
}
|
||||
#endif /* UIP_CONF_IPV6_RPL */
|
||||
if((nbr = uip_ds6_nbr_lookup(nexthop)) == NULL) {
|
||||
#if UIP_ND6_SEND_NA
|
||||
if((nbr = uip_ds6_nbr_add(nexthop, NULL, 0, NBR_INCOMPLETE)) == NULL) {
|
||||
uip_len = 0;
|
||||
return;
|
||||
@ -628,7 +629,9 @@ tcpip_ipv6_output(void)
|
||||
stimer_set(&nbr->sendns, uip_ds6_if.retrans_timer / 1000);
|
||||
nbr->nscount = 1;
|
||||
}
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
} else {
|
||||
#if UIP_ND6_SEND_NA
|
||||
if(nbr->state == NBR_INCOMPLETE) {
|
||||
PRINTF("tcpip_ipv6_output: nbr cache entry incomplete\n");
|
||||
#if UIP_CONF_IPV6_QUEUE_PKT
|
||||
@ -650,6 +653,7 @@ tcpip_ipv6_output(void)
|
||||
nbr->nscount = 0;
|
||||
PRINTF("tcpip_ipv6_output: nbr cache entry stale moving to delay\n");
|
||||
}
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
|
||||
tcpip_output(&nbr->lladdr);
|
||||
|
||||
|
@ -204,6 +204,15 @@ uip_ds6_periodic(void)
|
||||
locnbr++) {
|
||||
if(locnbr->isused) {
|
||||
switch(locnbr->state) {
|
||||
case NBR_REACHABLE:
|
||||
if(stimer_expired(&locnbr->reachable)) {
|
||||
PRINTF("REACHABLE: moving to STALE (");
|
||||
PRINT6ADDR(&locnbr->ipaddr);
|
||||
PRINTF(")\n");
|
||||
locnbr->state = NBR_STALE;
|
||||
}
|
||||
break;
|
||||
#if UIP_ND6_SEND_NA
|
||||
case NBR_INCOMPLETE:
|
||||
if(locnbr->nscount >= UIP_ND6_MAX_MULTICAST_SOLICIT) {
|
||||
uip_ds6_nbr_rm(locnbr);
|
||||
@ -214,14 +223,6 @@ uip_ds6_periodic(void)
|
||||
stimer_set(&locnbr->sendns, uip_ds6_if.retrans_timer / 1000);
|
||||
}
|
||||
break;
|
||||
case NBR_REACHABLE:
|
||||
if(stimer_expired(&locnbr->reachable)) {
|
||||
PRINTF("REACHABLE: moving to STALE (");
|
||||
PRINT6ADDR(&locnbr->ipaddr);
|
||||
PRINTF(")\n");
|
||||
locnbr->state = NBR_STALE;
|
||||
}
|
||||
break;
|
||||
case NBR_DELAY:
|
||||
if(stimer_expired(&locnbr->reachable)) {
|
||||
locnbr->state = NBR_PROBE;
|
||||
@ -246,6 +247,7 @@ uip_ds6_periodic(void)
|
||||
stimer_set(&locnbr->sendns, uip_ds6_if.retrans_timer / 1000);
|
||||
}
|
||||
break;
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -57,17 +57,6 @@
|
||||
#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
|
||||
#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 */
|
||||
/** @{ */
|
||||
#define UIP_ND6_MAX_RTR_SOLICITATION_DELAY 1
|
||||
@ -82,6 +71,11 @@
|
||||
#else
|
||||
#define UIP_ND6_SEND_RA UIP_CONF_ND6_SEND_RA
|
||||
#endif
|
||||
#ifndef UIP_CONF_ND6_SEND_NA
|
||||
#define UIP_ND6_SEND_NA 1 /* enable/disable NA sending */
|
||||
#else
|
||||
#define UIP_ND6_SEND_NA UIP_CONF_ND6_SEND_NA
|
||||
#endif
|
||||
#define UIP_ND6_MAX_RA_INTERVAL 600
|
||||
#define UIP_ND6_MIN_RA_INTERVAL (UIP_ND6_MAX_RA_INTERVAL / 3)
|
||||
#define UIP_ND6_M_FLAG 0
|
||||
@ -95,6 +89,16 @@
|
||||
#define UIP_ND6_MAX_RA_DELAY_TIME_MS 500 /*milli seconds*/
|
||||
/** @} */
|
||||
|
||||
#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 UIP_ND6_SEND_NA
|
||||
#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 Node constant */
|
||||
#define UIP_ND6_MAX_MULTICAST_SOLICIT 3
|
||||
|
@ -1391,10 +1391,20 @@ uip_process(uint8_t flag)
|
||||
|
||||
switch(UIP_ICMP_BUF->type) {
|
||||
case ICMP6_NS:
|
||||
#if UIP_ND6_SEND_NA
|
||||
uip_nd6_ns_input();
|
||||
#else /* UIP_ND6_SEND_NA */
|
||||
UIP_STAT(++uip_stat.icmp.drop);
|
||||
uip_len = 0;
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
break;
|
||||
case ICMP6_NA:
|
||||
#if UIP_ND6_SEND_NA
|
||||
uip_nd6_na_input();
|
||||
#else /* UIP_ND6_SEND_NA */
|
||||
UIP_STAT(++uip_stat.icmp.drop);
|
||||
uip_len = 0;
|
||||
#endif /* UIP_ND6_SEND_NA */
|
||||
break;
|
||||
case ICMP6_RS:
|
||||
#if UIP_CONF_ROUTER && UIP_ND6_SEND_RA
|
||||
|
Loading…
Reference in New Issue
Block a user