From fd0af07d2dfdb09c6ef8245329414765f3c8021b Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Mon, 2 Jul 2018 20:31:38 +0200 Subject: [PATCH] tcp/udp bind: small code restructuring for IPv6-only See bug #54229 --- src/core/tcp.c | 4 ++-- src/core/udp.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 46927072..c98c43f5 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -672,11 +672,11 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) if (ipaddr == NULL) { ipaddr = IP4_ADDR_ANY; } +#else /* LWIP_IPV4 */ + LWIP_ERROR("tcp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG); #endif /* LWIP_IPV4 */ - /* still need to check for ipaddr == NULL in IPv6 only case */ LWIP_ERROR("tcp_bind: invalid pcb", pcb != NULL, return ERR_ARG); - LWIP_ERROR("tcp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG); LWIP_ERROR("tcp_bind: can only bind in state CLOSED", pcb->state == CLOSED, return ERR_VAL); diff --git a/src/core/udp.c b/src/core/udp.c index ac0e4d6e..9d2cb4af 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -944,11 +944,11 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) if (ipaddr == NULL) { ipaddr = IP4_ADDR_ANY; } +#else /* LWIP_IPV4 */ + LWIP_ERROR("udp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG); #endif /* LWIP_IPV4 */ - /* still need to check for ipaddr == NULL in IPv6 only case */ LWIP_ERROR("udp_bind: invalid pcb", pcb != NULL, return ERR_ARG); - LWIP_ERROR("udp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG); LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_bind(ipaddr = ")); ip_addr_debug_print(UDP_DEBUG | LWIP_DBG_TRACE, ipaddr);