diff --git a/src/core/udp.c b/src/core/udp.c index 7550c64b..2d345437 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -649,8 +649,10 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_i else #endif /* LWIP_IPV4 && LWIP_IPV6 */ #if LWIP_IPV4 - if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) { - /* use outgoing network interface IP address as source address */ + if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) || + 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); } else { /* check if UDP PCB local IP address is correct