From 258cab1b22327a31016fe9db92a98b2843f1c5a6 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Mon, 23 Jul 2018 21:47:33 +0200 Subject: [PATCH] fix bug #54315 (IPV6_V6ONLY socket accepts IPV4 connections) Signed-off-by: Simon Goldschmidt --- src/core/tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index c98c43f5..dcf2495c 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -734,7 +734,11 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) } } - if (!ip_addr_isany(ipaddr)) { + if (!ip_addr_isany(ipaddr) +#if LWIP_IPV4 && LWIP_IPV6 + || (IP_GET_TYPE(ipaddr) != IP_GET_TYPE(&pcb->local_ip)) +#endif /* LWIP_IPV4 && LWIP_IPV6 */ + ) { ip_addr_set(&pcb->local_ip, ipaddr); } pcb->local_port = port;