IPv6 addr: clarify tentative count/LWIP_IPV6_DUP_DETECT_ATTEMPTS

This commit is contained in:
sg 2016-08-18 22:02:57 +02:00
parent 7c0d952379
commit 43d6812b3e
3 changed files with 8 additions and 3 deletions

View File

@ -62,6 +62,9 @@
#include <string.h>
#if LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK
#error LWIP_IPV6_DUP_DETECT_ATTEMPTS > IP6_ADDR_TENTATIVE_COUNT_MASK
#endif
/* Router tables. */
struct nd6_neighbor_cache_entry neighbor_cache[LWIP_ND6_NUM_NEIGHBORS];
@ -805,13 +808,13 @@ nd6_tmr(void)
for (netif = netif_list; netif != NULL; netif = netif->next) {
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; ++i) {
if (ip6_addr_istentative(netif->ip6_addr_state[i])) {
if ((netif->ip6_addr_state[i] & 0x07) >= LWIP_IPV6_DUP_DETECT_ATTEMPTS) {
if ((netif->ip6_addr_state[i] & IP6_ADDR_TENTATIVE_COUNT_MASK) >= LWIP_IPV6_DUP_DETECT_ATTEMPTS) {
/* No NA received in response. Mark address as valid. */
netif->ip6_addr_state[i] = IP6_ADDR_PREFERRED;
/* @todo implement preferred and valid lifetimes. */
} else if (netif->flags & NETIF_FLAG_UP) {
#if LWIP_IPV6_MLD
if ((netif->ip6_addr_state[i] & 0x07) == 0) {
if ((netif->ip6_addr_state[i] & IP6_ADDR_TENTATIVE_COUNT_MASK) == 0) {
/* Join solicited node multicast group. */
ip6_addr_set_solicitednode(&multicast_address, netif_ip6_addr(netif, i)->addr[3]);
mld6_joingroup(netif_ip6_addr(netif, i), &multicast_address);

View File

@ -263,6 +263,8 @@ Little-endian version, stored in network order (no htonl). */
#define IP6_ADDR_PREFERRED 0x30
#define IP6_ADDR_DEPRECATED 0x50
#define IP6_ADDR_TENTATIVE_COUNT_MASK 0x07 /* 1-7 probes sent */
#define ip6_addr_isinvalid(addr_state) (addr_state == IP6_ADDR_INVALID)
#define ip6_addr_istentative(addr_state) (addr_state & IP6_ADDR_TENTATIVE)
#define ip6_addr_isvalid(addr_state) (addr_state & IP6_ADDR_VALID) /* Include valid, preferred, and deprecated. */

View File

@ -2214,7 +2214,7 @@
#endif
/**
* LWIP_IPV6_DUP_DETECT_ATTEMPTS: Number of duplicate address detection attempts.
* LWIP_IPV6_DUP_DETECT_ATTEMPTS=[0..7]: Number of duplicate address detection attempts.
*/
#if !defined LWIP_IPV6_DUP_DETECT_ATTEMPTS || defined __DOXYGEN__
#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 1