From b0e4ae4a5e92ffc13d8a86b1d3c3ebee69510b1b Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 17 Mar 2022 12:11:35 +0100 Subject: [PATCH] examples: Minor fixes in udp_nulticast socket examples Make sure that IPv6 mapped IPv4 addresses are not used when using vanilla lwip --- examples/protocols/sockets/udp_multicast/README.md | 2 +- .../sockets/udp_multicast/main/udp_multicast_example_main.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/protocols/sockets/udp_multicast/README.md b/examples/protocols/sockets/udp_multicast/README.md index 649bd61195..25224649f8 100644 --- a/examples/protocols/sockets/udp_multicast/README.md +++ b/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 diff --git a/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c b/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c index 2eed56f510..89eafe65e8 100644 --- a/examples/protocols/sockets/udp_multicast/main/udp_multicast_example_main.c +++ b/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,