Added a flag to optionally disable IPv6 NA/NS at compile time

This commit is contained in:
Simon Duquennoy 2013-07-02 13:52:11 +02:00
parent ad34b714cd
commit 1f38348cf9
3 changed files with 29 additions and 11 deletions

View file

@ -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);

View file

@ -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

View file

@ -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