From 09547832ba683f07364d9526e080479286494c36 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Wed, 23 Nov 2016 12:46:35 +0100 Subject: [PATCH] Fix bug #49662: UDP layer should filter incoming multicast datagrams against the bound IP address Change lwIP UDP API to match socket behavior. Multicast traffic is now only received on a UDP PCB (and therefore on a UDP socket/netconn) when the PCB is bound to IP_ADDR_ANY. --- src/core/udp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/core/udp.c b/src/core/udp.c index 491fb074..5786e4f9 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -178,15 +178,8 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast) } } else #endif /* LWIP_IPV4 */ - /* Handle IPv4 and IPv6: all, multicast or exact match */ - if (ip_addr_isany(&pcb->local_ip) || -#if LWIP_IPV6_MLD - (ip_current_is_v6() && ip6_addr_ismulticast(ip6_current_dest_addr())) || -#endif /* LWIP_IPV6_MLD */ -#if LWIP_IGMP - (!ip_current_is_v6() && ip4_addr_ismulticast(ip4_current_dest_addr())) || -#endif /* LWIP_IGMP */ - ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { + /* Handle IPv4 and IPv6: all or exact match */ + if (ip_addr_isany(&pcb->local_ip) || ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) { return 1; } }