summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Ziegelmeier <dziegelmeier@de.pepperl-fuchs.com>2018-12-06 14:40:57 +0100
committerDirk Ziegelmeier <dziegelmeier@de.pepperl-fuchs.com>2018-12-06 14:40:57 +0100
commit2ff0db9a9b047d1c94ddbeea010561d1b9032101 (patch)
treeb2efc6c11b19406d40616da76a74306e442569c4
parent91037b4c287e1a124ff5801222e4b8e04050ea42 (diff)
downloadlwip-2ff0db9a9b047d1c94ddbeea010561d1b9032101.tar.gz
Fix bug #55171: Binding UDP PCB with different IP type PCBs does not work
by additionally checking IP address type
-rw-r--r--src/core/udp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/udp.c b/src/core/udp.c
index 7c25912..54be79d 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -997,8 +997,10 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
{
/* port matches that of PCB in list and REUSEADDR not set -> reject */
if ((ipcb->local_port == port) &&
+ (IP_GET_TYPE(&ipcb->local_ip) == IP_GET_TYPE(ipaddr)) &&
/* IP address matches or any IP used? */
- (ip_addr_cmp(&ipcb->local_ip, ipaddr) || ip_addr_isany(ipaddr) ||
+ (ip_addr_cmp(&ipcb->local_ip, ipaddr) ||
+ ip_addr_isany(ipaddr) ||
ip_addr_isany(&ipcb->local_ip))) {
/* other PCB already binds to this local IP and port */
LWIP_DEBUGF(UDP_DEBUG,