mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-27 00:22:59 +00:00
udp: use netif addr as src for multicast sockets
Sockets bound to a multicast address could not transmit multicast packets because the pcb local address did not match the netif address even if the outgoing netif was resolved correctly. To correct the issue, pcbs with a multicast local address will use the outgoing netif address as the source address in IPv4.
This commit is contained in:
parent
87354abf0f
commit
8ac1b4825a
@ -649,8 +649,10 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_i
|
|||||||
else
|
else
|
||||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||||
#if LWIP_IPV4
|
#if LWIP_IPV4
|
||||||
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
|
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
|
||||||
/* use outgoing network interface IP address as source address */
|
ip4_addr_ismulticast(ip_2_ip4(&pcb->local_ip))) {
|
||||||
|
/* if the local_ip is any or multicast
|
||||||
|
* use the outgoing network interface IP address as source address */
|
||||||
src_ip = netif_ip_addr4(netif);
|
src_ip = netif_ip_addr4(netif);
|
||||||
} else {
|
} else {
|
||||||
/* check if UDP PCB local IP address is correct
|
/* check if UDP PCB local IP address is correct
|
||||||
|
Loading…
Reference in New Issue
Block a user