From d12e8c7581106f83bc6b8feccb714ff95bfa5820 Mon Sep 17 00:00:00 2001 From: jb1228 <37507376+jb1228@users.noreply.github.com> Date: Sun, 1 Mar 2026 21:51:27 -0500 Subject: [PATCH 1/2] Add mDNS dep and handle IPv4-only mDNS addr Add `mdns` to the component private requirements so mDNS symbols are available at build time. In connection_handler.c add a conditional to read the IPv4 address from the mdns result when IPv6 is disabled, falling back to ip_addr_copy for dual-stack builds. This avoids accessing IPv6 fields when LWIP IPv6 support is turned off. --- components/snapclient/CMakeLists.txt | 2 +- components/snapclient/connection_handler.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/snapclient/CMakeLists.txt b/components/snapclient/CMakeLists.txt index 0b4ce4fc..d3655901 100644 --- a/components/snapclient/CMakeLists.txt +++ b/components/snapclient/CMakeLists.txt @@ -1,7 +1,7 @@ idf_component_register(SRCS "snapclient_helper.c" "snapclient.c" "connection_handler.c" INCLUDE_DIRS "include" - PRIV_REQUIRES esp_timer opus flac lightsnapcast + PRIV_REQUIRES esp_timer mdns opus flac lightsnapcast ) if(CONFIG_USE_DSP_PROCESSOR) diff --git a/components/snapclient/connection_handler.c b/components/snapclient/connection_handler.c index f22cd49b..a98ab7f7 100644 --- a/components/snapclient/connection_handler.c +++ b/components/snapclient/connection_handler.c @@ -139,7 +139,11 @@ void setup_network(esp_netif_t** netif) { continue; } + #if CONFIG_LWIP_IPV4 && !CONFIG_LWIP_IPV6 + remote_ip.addr = re->addr->addr.u_addr.ip4.addr; + #else ip_addr_copy(remote_ip, re->addr->addr); + #endif remotePort = r->port; mdns_query_results_free(r); From 35c7c8980275ad3a4cc92c52ee645795105b9230 Mon Sep 17 00:00:00 2001 From: luar123 <49960470+luar123@users.noreply.github.com> Date: Wed, 4 Mar 2026 21:50:12 +0100 Subject: [PATCH 2/2] Update components/snapclient/connection_handler.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- components/snapclient/connection_handler.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/snapclient/connection_handler.c b/components/snapclient/connection_handler.c index a98ab7f7..67da69b9 100644 --- a/components/snapclient/connection_handler.c +++ b/components/snapclient/connection_handler.c @@ -139,11 +139,11 @@ void setup_network(esp_netif_t** netif) { continue; } - #if CONFIG_LWIP_IPV4 && !CONFIG_LWIP_IPV6 +#if CONFIG_LWIP_IPV4 && !CONFIG_LWIP_IPV6 remote_ip.addr = re->addr->addr.u_addr.ip4.addr; - #else +#else ip_addr_copy(remote_ip, re->addr->addr); - #endif +#endif remotePort = r->port; mdns_query_results_free(r);