Browse Source

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

See bug #54229
STABLE-2_1_x
Simon Goldschmidt 8 years ago
parent
commit
fd0af07d2d
  1. 4
      src/core/tcp.c
  2. 4
      src/core/udp.c

4
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);

4
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);

Loading…
Cancel
Save