mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-24 18:46:33 +08:00
Merge branch 'feature/add_ipv6_support' into 'master'
feat(lwip): add IPv6 support See merge request sdk/ESP8266_RTOS_SDK!509
This commit is contained in:
@ -702,6 +702,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:
|
||||
@ -867,8 +883,20 @@ nd6_tmr(void)
|
||||
if ((addr_state & IP6_ADDR_TENTATIVE_COUNT_MASK) >= LWIP_IPV6_DUP_DETECT_ATTEMPTS) {
|
||||
/* No NA received in response. Mark address as valid. */
|
||||
netif_ip6_addr_set_state(netif, 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
|
||||
if ((netif_ip6_addr_state(netif, i) & 0x07) == 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);
|
||||
}
|
||||
#endif /* LWIP_IPV6_MLD */
|
||||
/* Send a NS for this address. */
|
||||
nd6_send_ns(netif, netif_ip6_addr(netif, i), ND6_SEND_FLAG_MULTICAST_DEST);
|
||||
/* tentative: set next state by increasing by one */
|
||||
|
@ -75,6 +75,11 @@ void nd6_cleanup_netif(struct netif *netif);
|
||||
void nd6_adjust_mld_membership(struct netif *netif, s8_t addr_idx, u8_t new_state);
|
||||
#endif /* LWIP_IPV6_MLD */
|
||||
|
||||
#if ESP_LWIP
|
||||
/** set nd6 callback when ipv6 addr state pref*/
|
||||
void nd6_set_cb(struct netif *netif, void (*cb)(struct netif *netif, u8_t ip_index));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -238,6 +238,10 @@ struct netif {
|
||||
/** The state of each IPv6 address (Tentative, Preferred, etc).
|
||||
* @see ip6_addr.h */
|
||||
u8_t ip6_addr_state[LWIP_IPV6_NUM_ADDRESSES];
|
||||
#if ESP_LWIP
|
||||
void (*ipv6_addr_cb)(struct netif* netif, u8_t ip_idex); /* callback for ipv6 addr states changed */
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_IPV6 */
|
||||
/** This function is called by the network device driver
|
||||
* to pass a packet up the TCP/IP stack. */
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/dhcp.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/ip6_addr.h"
|
||||
#include "lwip/nd6.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/errno.h"
|
||||
#include "lwip/timeouts.h"
|
||||
@ -55,7 +58,7 @@ struct tcpip_adapter_api_call_data {
|
||||
static struct netif *esp_netif[TCPIP_ADAPTER_IF_MAX];
|
||||
static tcpip_adapter_ip_info_t esp_ip[TCPIP_ADAPTER_IF_MAX];
|
||||
static tcpip_adapter_ip_info_t esp_ip_old[TCPIP_ADAPTER_IF_MAX];
|
||||
#if 0
|
||||
#if TCPIP_ADAPTER_IPV6
|
||||
/*TODO need add ip6*/
|
||||
static tcpip_adapter_ip6_info_t esp_ip6[TCPIP_ADAPTER_IF_MAX];
|
||||
#endif
|
||||
@ -561,7 +564,7 @@ esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if TCPIP_ADAPTER_IPV6
|
||||
static void tcpip_adapter_nd6_cb(struct netif *p_netif, uint8_t ip_idex)
|
||||
{
|
||||
tcpip_adapter_ip6_info_t *ip6_info;
|
||||
@ -609,7 +612,7 @@ esp_err_t tcpip_adapter_create_ip6_linklocal(tcpip_adapter_if_t tcpip_if)
|
||||
if (p_netif != NULL && netif_is_up(p_netif)) {
|
||||
netif_create_ip6_linklocal_address(p_netif, 1);
|
||||
/*TODO need add ipv6 address cb*/
|
||||
//nd6_set_cb(p_netif, tcpip_adapter_nd6_cb);
|
||||
nd6_set_cb(p_netif, tcpip_adapter_nd6_cb);
|
||||
|
||||
return ESP_OK;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user