From 904ae1223829303f0e61d78585aa9b7a3a7ea0ca Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Sat, 28 Oct 2023 00:23:40 -0400 Subject: [PATCH] curl_setup: disallow Windows IPv6 builds missing getaddrinfo - On Windows if IPv6 is enabled but getaddrinfo is missing then #error the build. curl can be built with IPv6 support (ENABLE_IPV6) but without the ability to resolve hosts to IPv6 addresses (HAVE_GETADDRINFO). On Windows this is highly unlikely and should be considered a bad build configuration. Such a bad configuration has already given us a bug that was hard to diagnose. See #12134 and #12136 for discussion. Ref: https://github.com/curl/curl/issues/12134 Ref: https://github.com/curl/curl/pull/12136 Closes https://github.com/curl/curl/pull/12221 --- lib/curl_setup.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 4ee0aa0a3e..fc462280f5 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -586,6 +586,9 @@ #if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO) # define CURLRES_IPV6 +#elif defined(ENABLE_IPV6) && (defined(WIN32) || defined(__CYGWIN__)) +/* assume on Windows that IPv6 without getaddrinfo is a broken build */ +# error "Unexpected build: IPv6 is enabled but getaddrinfo was not found." #else # define CURLRES_IPV4 #endif