lib: fix AF_INET6 use outside of USE_IPV6

Closes #14858
This commit is contained in:
Harry Sintonen 2024-09-11 13:10:44 +03:00 committed by Daniel Stenberg
parent 48f61e781a
commit 6a9f3764f1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 6 additions and 0 deletions

View file

@ -1749,7 +1749,11 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
return CURLE_OK;
}
case CF_QUERY_IP_INFO:
#ifdef USE_IPV6
*pres1 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
#else
*pres1 = FALSE;
#endif
*(struct ip_quadruple *)pres2 = ctx->ip;
return CURLE_OK;
default:

View file

@ -800,8 +800,10 @@ static CURLcode start_connect(struct Curl_cfilter *cf,
}
else {
/* no user preference, we try ipv6 always first when available */
#ifdef USE_IPV6
ai_family0 = AF_INET6;
addr0 = addr_first_match(remotehost->addr, ai_family0);
#endif
/* next candidate is ipv4 */
ai_family1 = AF_INET;
addr1 = addr_first_match(remotehost->addr, ai_family1);