fixed bug #34072: UDP broadcast is received from wrong UDP pcb if udp port matches

This commit is contained in:
Simon Goldschmidt 2011-09-09 22:25:59 +02:00
parent 5e8ee7e006
commit 4849eb4c54
2 changed files with 18 additions and 10 deletions

View File

@ -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

View File

@ -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 */