From 7e69af6b09182abea3a2cc4c7ee0b3ea89a794d8 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 8 Jul 2025 12:49:23 +0300 Subject: [PATCH 1/2] fix(async): Update IP setup in AsyncUDP --- libraries/AsyncUDP/src/AsyncUDP.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index cab9c951921..a47ec6a9d7f 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -582,8 +582,8 @@ bool AsyncUDP::listen(const ip_addr_t *addr, uint16_t port) { } close(); if (addr) { - IP_SET_TYPE_VAL(_pcb->local_ip, addr->type); - IP_SET_TYPE_VAL(_pcb->remote_ip, addr->type); + IP_SET_TYPE(_pcb->local_ip, IP_GET_TYPE(addr)); + IP_SET_TYPE(_pcb->remote_ip, IP_GET_TYPE(addr)); } if (_udp_bind(_pcb, addr, port) != ERR_OK) { return false; @@ -692,17 +692,8 @@ bool AsyncUDP::listenMulticast(const ip_addr_t *addr, uint16_t port, uint8_t ttl return false; } -#if CONFIG_LWIP_IPV6 - if (IP_IS_V6(addr)) { - IP_SET_TYPE(&bind_addr, IPADDR_TYPE_V6); - ip6_addr_set_any(&bind_addr.u_addr.ip6); - } else { -#endif - IP_SET_TYPE(&bind_addr, IPADDR_TYPE_V4); - ip4_addr_set_any(&bind_addr.u_addr.ip4); -#if CONFIG_LWIP_IPV6 - } -#endif + IP_SET_TYPE(&bind_addr, IP_GET_TYPE(addr)); + ip_addr_set_any(IP_IS_V6(addr), &bind_addr); if (!listen(&bind_addr, port)) { return false; } From 60e70dc25e50521d651daf9bed59b04a81950208 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 8 Jul 2025 13:07:19 +0300 Subject: [PATCH 2/2] fix(udp): Revert to IP_SET_TYPE_VAL in connect --- libraries/AsyncUDP/src/AsyncUDP.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index a47ec6a9d7f..2d533831cd5 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -582,8 +582,8 @@ bool AsyncUDP::listen(const ip_addr_t *addr, uint16_t port) { } close(); if (addr) { - IP_SET_TYPE(_pcb->local_ip, IP_GET_TYPE(addr)); - IP_SET_TYPE(_pcb->remote_ip, IP_GET_TYPE(addr)); + IP_SET_TYPE_VAL(_pcb->local_ip, IP_GET_TYPE(addr)); + IP_SET_TYPE_VAL(_pcb->remote_ip, IP_GET_TYPE(addr)); } if (_udp_bind(_pcb, addr, port) != ERR_OK) { return false;