Browse Source

examples: Minor fixes in udp_nulticast socket examples

Make sure that IPv6 mapped IPv4 addresses are not used when using
vanilla lwip
David Cermak 3 years ago
parent
commit
b0e4ae4a5e

+ 1 - 1
examples/protocols/sockets/udp_multicast/README.md

@@ -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
 

+ 4 - 0
examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c

@@ -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,