mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-31 15:41:02 +08:00
feat(lwip): update lwip component according to IDF
commit ID: 79a5b0b5
This commit is contained in:
@ -13,10 +13,33 @@ menu "Example Connection Configuration"
|
||||
Can be left blank if the network has no security set.
|
||||
|
||||
config EXAMPLE_CONNECT_IPV6
|
||||
bool "Obtain IPv6 link-local address"
|
||||
bool "Obtain IPv6 address"
|
||||
default n
|
||||
select LWIP_IPV6
|
||||
help
|
||||
By default, examples will wait until IPv4 and IPv6 addresses are obtained.
|
||||
By default, examples will wait until IPv4 and IPv6 local link addresses are obtained.
|
||||
Disable this option if the network does not support IPv6.
|
||||
Choose the preferred IPv6 address type if the connection code should wait until other than
|
||||
the local link address gets assigned.
|
||||
|
||||
if EXAMPLE_CONNECT_IPV6
|
||||
choice EXAMPLE_CONNECT_PREFERRED_IPV6
|
||||
prompt "Preferred IPv6 Type"
|
||||
default EXAMPLE_CONNECT_IPV6_PREF_LOCAL_LINK
|
||||
help
|
||||
Select which kind of IPv6 address the connect logic waits for.
|
||||
|
||||
config EXAMPLE_CONNECT_IPV6_PREF_LOCAL_LINK
|
||||
bool "Local Link Address"
|
||||
help
|
||||
Blocks until Local link address assigned.
|
||||
|
||||
config EXAMPLE_CONNECT_IPV6_PREF_GLOBAL
|
||||
bool "Global Address"
|
||||
select LWIP_IPV6_AUTOCONFIG
|
||||
help
|
||||
Blocks until Global address assigned.
|
||||
endchoice
|
||||
|
||||
endif
|
||||
endmenu
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
#ifdef CONFIG_EXAMPLE_CONNECT_IPV6
|
||||
#define CONNECTED_BITS (GOT_IPV4_BIT | GOT_IPV6_BIT)
|
||||
#if defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_LOCAL_LINK)
|
||||
#define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE 0
|
||||
#elif defined(CONFIG_EXAMPLE_CONNECT_IPV6_PREF_GLOBAL)
|
||||
#define EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE 1
|
||||
#endif
|
||||
#else
|
||||
#define CONNECTED_BITS (GOT_IPV4_BIT)
|
||||
#endif
|
||||
@ -78,7 +83,13 @@ static void on_got_ipv6(void *arg, esp_event_base_t event_base,
|
||||
{
|
||||
ip_event_got_ip6_t *event = (ip_event_got_ip6_t *)event_data;
|
||||
memcpy(&s_ipv6_addr, &event->ip6_info.ip, sizeof(s_ipv6_addr));
|
||||
xEventGroupSetBits(s_connect_event_group, GOT_IPV6_BIT);
|
||||
if (EXAMPLE_CONNECT_PREFERRED_IPV6_TYPE) {
|
||||
if (ip6_addr_isglobal(&s_ipv6_addr)) {
|
||||
xEventGroupSetBits(s_connect_event_group, GOT_IPV6_BIT);
|
||||
}
|
||||
} else {
|
||||
xEventGroupSetBits(s_connect_event_group, GOT_IPV6_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CONFIG_EXAMPLE_CONNECT_IPV6
|
||||
|
@ -57,6 +57,7 @@ static void tcp_client_task(void *pvParameters)
|
||||
inet6_aton(HOST_IP_ADDR, &destAddr.sin6_addr);
|
||||
destAddr.sin6_family = AF_INET6;
|
||||
destAddr.sin6_port = htons(PORT);
|
||||
destAddr.sin6_scope_id = tcpip_adapter_get_netif_index(TCPIP_ADAPTER_IF_STA);
|
||||
addr_family = AF_INET6;
|
||||
ip_protocol = IPPROTO_IPV6;
|
||||
inet6_ntoa_r(destAddr.sin6_addr, addr_str, sizeof(addr_str) - 1);
|
||||
@ -72,6 +73,8 @@ static void tcp_client_task(void *pvParameters)
|
||||
int err = connect(sock, (struct sockaddr *)&destAddr, sizeof(destAddr));
|
||||
if (err != 0) {
|
||||
ESP_LOGE(TAG, "Socket unable to connect: errno %d", errno);
|
||||
close(sock);
|
||||
continue;
|
||||
}
|
||||
ESP_LOGI(TAG, "Successfully connected");
|
||||
|
||||
|
@ -57,6 +57,7 @@ static void udp_client_task(void *pvParameters)
|
||||
inet6_aton(HOST_IP_ADDR, &destAddr.sin6_addr);
|
||||
destAddr.sin6_family = AF_INET6;
|
||||
destAddr.sin6_port = htons(PORT);
|
||||
destAddr.sin6_scope_id = tcpip_adapter_get_netif_index(TCPIP_ADAPTER_IF_STA);
|
||||
addr_family = AF_INET6;
|
||||
ip_protocol = IPPROTO_IPV6;
|
||||
inet6_ntoa_r(destAddr.sin6_addr, addr_str, sizeof(addr_str) - 1);
|
||||
|
Reference in New Issue
Block a user