-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit d6a76da
authored
fix(libraries/asyncudp): IPv4 ONLY listenMulticast() (#11444)
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).1 parent 0aada09 commit d6a76da
1 file changed
+14
-1
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
682 | 682 |
| |
683 | 683 |
| |
684 | 684 |
| |
685 | + | ||
686 | + | ||
685 | 687 |
| |
686 | 688 |
| |
687 | 689 |
| |
| |||
690 | 692 |
| |
691 | 693 |
| |
692 | 694 |
| |
693 | - | ||
695 | + | ||
696 | + | ||
697 | + | ||
698 | + | ||
699 | + | ||
700 | + | ||
701 | + | ||
702 | + | ||
703 | + | ||
704 | + | ||
705 | + | ||
706 | + | ||
694 | 707 |
| |
695 | 708 |
| |
696 | 709 |
| |
|
0 commit comments