From ff04c2046e6d3e6240613d187b96cae134a81fe2 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 2 Feb 2017 10:25:05 +0100 Subject: [PATCH] Fix bug #50206: UDP Netconn bind to IP6_ADDR_ANY fails The tests were in to catch user errors, but they seem to get in the way of application programming :-) The checks in *_send() remain active to catch when PCB source and destination address types do not match --- src/core/raw.c | 4 ++-- src/core/tcp.c | 4 ++-- src/core/udp.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/raw.c b/src/core/raw.c index 4828df6f..333fcb11 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -211,7 +211,7 @@ raw_input(struct pbuf *p, struct netif *inp) err_t raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr) { - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; } ip_addr_set_ipaddr(&pcb->local_ip, ipaddr); @@ -235,7 +235,7 @@ raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr) err_t raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr) { - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; } ip_addr_set_ipaddr(&pcb->remote_ip, ipaddr); diff --git a/src/core/tcp.c b/src/core/tcp.c index afdf8bff..30896c45 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -551,7 +551,7 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) #endif /* LWIP_IPV4 */ /* still need to check for ipaddr == NULL in IPv6 only case */ - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; } @@ -859,7 +859,7 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port, u32_t iss; u16_t old_local_port; - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; } diff --git a/src/core/udp.c b/src/core/udp.c index a9164149..ce2e3d29 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -892,7 +892,7 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) #endif /* LWIP_IPV4 */ /* still need to check for ipaddr == NULL in IPv6 only case */ - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; } @@ -982,7 +982,7 @@ udp_connect(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) { struct udp_pcb *ipcb; - if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) { + if ((pcb == NULL) || (ipaddr == NULL)) { return ERR_VAL; }