lwip: Support IPv6 only mode

This commit is contained in:
David Cermak
2022-10-03 17:28:01 +02:00
parent 2c8c8bfd2d
commit 5f6cb31105
40 changed files with 336 additions and 80 deletions

View File

@@ -41,6 +41,7 @@ esp_err_t get_addr_from_stdin(int port, int sock_type, int *ip_protocol, int *ad
}
for( cur = addr_list; cur != NULL; cur = cur->ai_next ) {
memcpy(dest_addr, cur->ai_addr, sizeof(*dest_addr));
#if CONFIG_EXAMPLE_CONNECT_IPV4
if (cur->ai_family == AF_INET) {
*ip_protocol = IPPROTO_IP;
*addr_family = AF_INET;
@@ -48,10 +49,10 @@ esp_err_t get_addr_from_stdin(int port, int sock_type, int *ip_protocol, int *ad
((struct sockaddr_in*)dest_addr)->sin_port = htons(port);
freeaddrinfo( addr_list );
return ESP_OK;
}
#endif // IPV4
#if CONFIG_EXAMPLE_CONNECT_IPV6
else if (cur->ai_family == AF_INET6) {
if (cur->ai_family == AF_INET6) {
*ip_protocol = IPPROTO_IPV6;
*addr_family = AF_INET6;
// add port and interface number and return on first IPv6 match
@@ -60,7 +61,7 @@ esp_err_t get_addr_from_stdin(int port, int sock_type, int *ip_protocol, int *ad
freeaddrinfo( addr_list );
return ESP_OK;
}
#endif
#endif // IPV6
}
// no match found
freeaddrinfo( addr_list );