tcp/udp bind: small code restructuring for IPv6-only

See bug #54229
This commit is contained in:
Simon Goldschmidt 2018-07-02 20:31:38 +02:00
parent 1e24f9c9cd
commit fd0af07d2d
2 changed files with 4 additions and 4 deletions

View File

@ -672,11 +672,11 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY; ipaddr = IP4_ADDR_ANY;
} }
#else /* LWIP_IPV4 */
LWIP_ERROR("tcp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG);
#endif /* LWIP_IPV4 */ #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 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); LWIP_ERROR("tcp_bind: can only bind in state CLOSED", pcb->state == CLOSED, return ERR_VAL);

View File

@ -944,11 +944,11 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
if (ipaddr == NULL) { if (ipaddr == NULL) {
ipaddr = IP4_ADDR_ANY; ipaddr = IP4_ADDR_ANY;
} }
#else /* LWIP_IPV4 */
LWIP_ERROR("udp_bind: invalid ipaddr", ipaddr != NULL, return ERR_ARG);
#endif /* LWIP_IPV4 */ #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 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 = ")); LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_bind(ipaddr = "));
ip_addr_debug_print(UDP_DEBUG | LWIP_DBG_TRACE, ipaddr); ip_addr_debug_print(UDP_DEBUG | LWIP_DBG_TRACE, ipaddr);