- Notifications
You must be signed in to change notification settings - Fork7.8k
fix(libraries/asyncudp): IPv4 ONLY listenMulticast()#11444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(libraries/asyncudp): IPv4 ONLY listenMulticast()#11444
Uh oh!
There was an error while loading.Please reload this page.
Conversation
AsyncUDP::listenMulticast() properly receives packets sent to IPv4multicast addresses like 239.1.2.3, but it is not receiving packets sentto IPv6 multicast addresses like ff12::6ood:cafe.The root cause is a bit hidden: listen(NULL, port) would matchAsyncUDP::listen(const ip_addr_t *addr, uint16_t port), which calls_udp_bind(_pcb, addr, port), which uses the lwIP API to calludp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) atthe end. If lwIP has LWIP_IPV4 enabled, it checks if ipaddr == NULL andsets it to IP4_ADDR_ANY. So an IPv6 address is never bound.This fix checks the IP address passed to AsyncUDP::listenMulticast(). Ifit is an IPv6 address, it constructs and passes the IPv6 any address(::); otherwise (IPv4), it constructs and passes the IPv4 any address(0.0.0.0).
github-actionsbot commentedJun 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
👋Hello nikiwaibel, we appreciate your contribution to this project! 📘 Please review the project'sContributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 12m 44s ⏱️ Results for commit57f2ba7. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
d6a76da intoespressif:masterUh oh!
There was an error while loading.Please reload this page.
Description of Change
AsyncUDP::listenMulticast() properly receives packets sent to IPv4 multicast addresses like 239.1.2.3, but it is not receiving packets sent to IPv6 multicast addresses like ff12::6ood:cafe.
The root cause is a bit hidden: listen(NULL, port) would match AsyncUDP::listen(const ip_addr_t *addr, uint16_t port), which calls _udp_bind(_pcb, addr, port), which uses the lwIP API to call udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) at the end. If lwIP has LWIP_IPV4 enabled, it checks if ipaddr == NULL and sets it to IP4_ADDR_ANY. So an IPv6 address is never bound.
This fix checks the IP address passed to AsyncUDP::listenMulticast(). If it is an IPv6 address, it constructs and passes the IPv6 any address (::); otherwise (IPv4), it constructs and passes the IPv4 any address (0.0.0.0).
Tests scenarios
I've tested my Pull Request on Arduino-esp32 core v3.2.0 with a Heltec v3 (ESP32-S3) board.
Related links
Fixes#9970 (it was auto-closed).
In PR#11443 i've used a branch name with uppercase letters, which produced some warnings.