Merge pull request #6865 from per-allansson/wolfio-getaddrinfo-hints-a

wolfio: request only IPv4 addresses unless IPv6 support is enabled
This commit is contained in:
JacobBarthelmeh
2023-10-13 09:53:38 -06:00
committed by GitHub

View File

@ -1106,7 +1106,11 @@ int wolfIO_TcpConnect(SOCKET_T* sockfd, const char* ip, word16 port, int to_sec)
/* use gethostbyname for c99 */
#if defined(HAVE_GETADDRINFO)
XMEMSET(&hints, 0, sizeof(hints));
#ifdef WOLFSSL_IPV6
hints.ai_family = AF_UNSPEC; /* detect IPv4 or IPv6 */
#else
hints.ai_family = AF_INET; /* detect only IPv4 */
#endif
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;