From 28832ba9c22391efb9fa838a59116e429062936e Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Wed, 23 Oct 2002 19:44:32 +0000 Subject: [PATCH] Added #if LWIP_UDP around udp_init() body, fixed bug where un-connected UDP PCBs did not always receive correct datagram --- src/core/udp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/udp.c b/src/core/udp.c index ef014922..445007ed 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -67,7 +67,9 @@ int udp_debug_print(struct udp_hdr *udphdr); void udp_init(void) { +#if LWIP_UDP udp_pcbs = pcb_cache = NULL; +#endif /* LWIP_UDP */ } #if LWIP_UDP @@ -117,7 +119,8 @@ udp_lookup(struct ip_hdr *iphdr, struct netif *inp) if(pcb == NULL) { for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) { - if(pcb->local_port == dest && + if(pcb->remote_port == 0 && + pcb->local_port == dest && (ip_addr_isany(&pcb->remote_ip) || ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src))) && (ip_addr_isany(&pcb->local_ip) ||