Skip to content

Commit f247e6b

Browse files
Merge pull request #6865 from per-allansson/wolfio-getaddrinfo-hints-a
wolfio: request only IPv4 addresses unless IPv6 support is enabled
2 parents 95137f9 + 5f20f11 commit f247e6b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/wolfio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,11 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
11061106
/* use gethostbyname for c99 */
11071107
#if defined(HAVE_GETADDRINFO)
11081108
XMEMSET(&hints, 0, sizeof(hints));
1109+
#ifdef WOLFSSL_IPV6
11091110
hints.ai_family = AF_UNSPEC; /* detect IPv4 or IPv6 */
1111+
#else
1112+
hints.ai_family = AF_INET; /* detect only IPv4 */
1113+
#endif
11101114
hints.ai_socktype = SOCK_STREAM;
11111115
hints.ai_protocol = IPPROTO_TCP;
11121116

0 commit comments

Comments
 (0)