examples: Minor fixes in udp_nulticast socket examples

Make sure that IPv6 mapped IPv4 addresses are not used when using
vanilla lwip
This commit is contained in:
David Cermak 2022-03-17 12:11:35 +01:00
parent 5b471a1848
commit b0e4ae4a5e
2 changed files with 5 additions and 1 deletions

View File

@ -8,7 +8,7 @@ The behaviour of the example is:
* Listens to specified multicast addresses (one IPV4 and/or one IPV6).
* Print any UDP packets received as ASCII text.
* If no packets are received it will periodicially (after 2.5 seconds) send its own plaintext packet(s) to the multicast address(es).
* If no packets are received it will periodically (after 2.5 seconds) send its own plaintext packet(s) to the multicast address(es).
## Configuration

View File

@ -417,8 +417,12 @@ static void mcast_example_task(void *pvParameters)
#ifdef CONFIG_EXAMPLE_IPV4_ONLY
hints.ai_family = AF_INET; // For an IPv4 socket
#else
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP // Resolving IPv4 mapped IPv6 addresses is supported only in the official TCPIP_LWIP stack (esp-lwip)
hints.ai_family = AF_INET6; // For an IPv4 socket with V4 mapped addresses
hints.ai_flags |= AI_V4MAPPED;
#endif // CONFIG_ESP_NETIF_TCPIP_LWIP
#endif
int err = getaddrinfo(CONFIG_EXAMPLE_MULTICAST_IPV4_ADDR,
NULL,