diff --git a/CHANGELOG b/CHANGELOG index 5c6875dd..2321f9f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -47,6 +47,10 @@ HISTORY ++ Bugfixes: + 2011-09-09: Simon Goldschmidt + * udp.c: fixed bug #34072: UDP broadcast is received from wrong UDP pcb if + udp port matches + 2011-09-03: Simon Goldschmidt * tcp_in.c: fixed bug #33952 PUSH flag in incoming packet is lost when packet is aggregated and sent to application diff --git a/src/core/udp.c b/src/core/udp.c index f948d1e1..87a64916 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -173,7 +173,8 @@ udp_input(struct pbuf *p, struct netif *inp) LWIP_DEBUGF(UDP_DEBUG, (", %"U16_F")\n", pcb->remote_port)); /* compare PCB local addr+port to UDP destination addr+port */ - if ((pcb->local_port == dest) && + if (pcb->local_port == dest) { + if ( #if LWIP_IPV6 ((PCB_ISIPV6(pcb) && (ip_current_is_v6()) && (ip6_addr_isany(ipX_2_ip6(&pcb->local_ip)) || @@ -192,15 +193,18 @@ udp_input(struct pbuf *p, struct netif *inp) ip_addr_ismulticast(ip_current_dest_addr()) || #endif /* LWIP_IGMP */ #if IP_SOF_BROADCAST_RECV - (broadcast && (pcb->so_options & SOF_BROADCAST)))))) { -#else /* IP_SOF_BROADCAST_RECV */ - (broadcast))))) { -#endif /* IP_SOF_BROADCAST_RECV */ - local_match = 1; - if ((uncon_pcb == NULL) && - ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) { - /* the first unconnected matching PCB */ - uncon_pcb = pcb; + (broadcast && (pcb->so_options & SOF_BROADCAST) && + ip_addr_netcmp(ipX_2_ip(&pcb->local_ip), ip_current_dest_addr(), &inp->netmask)))))) { +#else /* IP_SOF_BROADCAST_RECV */ + (broadcast && + ip_addr_netcmp(ipX_2_ip(&pcb->local_ip), ip_current_dest_addr(), &inp->netmask)))))) { +#endif /* IP_SOF_BROADCAST_RECV */ + local_match = 1; + if ((uncon_pcb == NULL) && + ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) { + /* the first unconnected matching PCB */ + uncon_pcb = pcb; + } } } /* compare PCB remote addr+port to UDP source addr+port */