fix bug #54315 (IPV6_V6ONLY socket accepts IPV4 connections)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2018-07-23 21:47:33 +02:00
parent c3d8b1ca80
commit 258cab1b22

View File

@ -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;