From 97b8abf16cb5ebca14f71f0036eef50c9cd88a9c Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 24 Jul 2012 10:34:09 -0600 Subject: [PATCH] Fix bug #36857: tcp_listen_dual_with_backlog() only works with ANY address Change-Id: I092a4c9978d88040214fc44a4c4b353be618d76c --- src/core/tcp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 05e7c7d8..a0cbb159 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -591,11 +591,12 @@ tcp_listen_dual_with_backlog(struct tcp_pcb *pcb, u8_t backlog) { struct tcp_pcb *lpcb; - if (!ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) { - return NULL; - } lpcb = tcp_listen_with_backlog(pcb, backlog); - if (lpcb != NULL) { + if ((lpcb != NULL) && + ipX_addr_isany(PCB_ISIPV6(pcb), &pcb->local_ip)) { + /* The default behavior is to accept connections on either + * IPv4 or IPv6, if not bound. */ + /* @see NETCONN_FLAG_IPV6_V6ONLY for changing this behavior */ ((struct tcp_pcb_listen*)lpcb)->accept_any_ip_version = 1; } return lpcb;