ipv6 interface: add branch for ipv6 interface

This commit is contained in:
tzx
2016-11-10 11:24:31 +08:00
committed by Wu Jian Gang
parent 4d81e40413
commit a8fb9f2b84
11 changed files with 202 additions and 54 deletions

View File

@@ -632,6 +632,22 @@ nd6_input(struct pbuf *p, struct netif *inp)
pbuf_free(p);
}
#ifdef ESP_LWIP
/** Set callback for ipv6 addr status changed .
*
* @param netif the netif from which to remove the struct dhcp
* @param cb callback for dhcp
*/
void nd6_set_cb(struct netif *netif, void (*cb)(struct netif *netif, u8_t ip_index))
{
LWIP_ASSERT("netif != NULL", netif != NULL);
if (netif != NULL && netif_is_up(netif)) {
netif->ipv6_addr_cb = cb;
}
}
#endif
/**
* Periodic timer for Neighbor discovery functions:
@@ -797,6 +813,12 @@ nd6_tmr(void)
if ((netif->ip6_addr_state[i] & 0x07) >= LWIP_IPV6_DUP_DETECT_ATTEMPTS) {
/* No NA received in response. Mark address as valid. */
netif->ip6_addr_state[i] = IP6_ADDR_PREFERRED;
#ifdef ESP_LWIP
if (netif->ipv6_addr_cb != NULL) {
netif->ipv6_addr_cb(netif, i);
}
#endif
/* TODO implement preferred and valid lifetimes. */
} else if (netif->flags & NETIF_FLAG_UP) {
#if LWIP_IPV6_MLD