From e411c98f702f0fb38dceec95e7507ef15a00d12c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 11 Apr 2024 12:01:58 +0000 Subject: [PATCH] build: prefer `USE_IPV6` macro internally (was: `ENABLE_IPV6`) Before this patch, two macros were used to guard IPv6 features in curl sources: `ENABLE_IPV6` and `USE_IPV6`. This patch makes the source use the latter for consistency with other similar switches. `-DENABLE_IPV6` remains accepted for compatibility as a synonym for `-DUSE_IPV6`, when passed to the compiler. `ENABLE_IPV6` also remains the name of the CMake and `Makefile.vc` options to control this feature. Closes #13349 --- CMakeLists.txt | 3 +++ configure.ac | 2 +- lib/Makefile.mk | 2 +- lib/altsvc.c | 2 +- lib/asyn-ares.c | 6 +++--- lib/asyn-thread.c | 4 ++-- lib/cf-socket.c | 26 ++++++++++++------------ lib/config-os400.h | 2 +- lib/config-plan9.h | 2 +- lib/config-riscos.h | 5 +---- lib/config-win32.h | 4 ---- lib/conncache.c | 2 +- lib/connect.c | 10 +++++----- lib/curl_addrinfo.c | 18 ++++++++--------- lib/curl_config.h.cmake | 2 +- lib/curl_setup.h | 11 ++++++++--- lib/doh.c | 8 ++++---- lib/ftp.c | 18 ++++++++--------- lib/hostip.c | 22 ++++++++++----------- lib/hostip.h | 2 +- lib/if2ip.c | 16 +++++++-------- lib/if2ip.h | 4 ++-- lib/inet_ntop.c | 4 ++-- lib/inet_pton.c | 4 ++-- lib/noproxy.c | 2 +- lib/setopt.c | 2 +- lib/setup-vms.h | 4 ++-- lib/sockaddr.h | 2 +- lib/socks.c | 6 +++--- lib/url.c | 6 +++--- lib/urlapi.c | 4 ++-- lib/urldata.h | 4 ++-- lib/version.c | 2 +- lib/vquic/curl_osslq.c | 4 ++-- lib/vtls/gtls.c | 4 ++-- lib/vtls/openssl.c | 4 ++-- lib/vtls/rustls.c | 4 ++-- lib/vtls/vtls.c | 4 ++-- tests/server/mqttd.c | 24 +++++++++++------------ tests/server/rtspd.c | 24 +++++++++++------------ tests/server/server_sockaddr.h | 2 +- tests/server/sockfilt.c | 30 ++++++++++++++-------------- tests/server/socksd.c | 16 +++++++-------- tests/server/sws.c | 24 +++++++++++------------ tests/server/tftpd.c | 36 +++++++++++++++++----------------- tests/unit/unit1607.c | 2 +- tests/unit/unit2600.c | 4 ++-- 47 files changed, 197 insertions(+), 196 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 433dc51a84..4607c51d13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,6 +303,9 @@ if(ENABLE_IPV6 AND NOT WIN32) list(APPEND CURL_LIBS "-framework SystemConfiguration") endif() endif() +if(ENABLE_IPV6) + set(USE_IPV6 ON) +endif() find_package(Perl) diff --git a/configure.ac b/configure.ac index 9bc7fabd82..c31870ded5 100644 --- a/configure.ac +++ b/configure.ac @@ -1700,7 +1700,7 @@ int main(void) if test "$ipv6" = yes; then curl_ipv6_msg="enabled" - AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) + AC_DEFINE(USE_IPV6, 1, [Define if you want to enable IPv6 support]) IPV6_ENABLED=1 AC_SUBST(IPV6_ENABLED) diff --git a/lib/Makefile.mk b/lib/Makefile.mk index 95f281b7d8..bb6873cc45 100644 --- a/lib/Makefile.mk +++ b/lib/Makefile.mk @@ -254,7 +254,7 @@ endif endif ifneq ($(findstring -ipv6,$(CFG)),) - CPPFLAGS += -DENABLE_IPV6 + CPPFLAGS += -DUSE_IPV6 endif ifneq ($(findstring -watt,$(CFG))$(MSDOS),) diff --git a/lib/altsvc.c b/lib/altsvc.c index 4fc4fe60f0..22e7ad1d83 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -252,7 +252,7 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp) CURLcode result = Curl_gmtime(as->expires, &stamp); if(result) return result; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else { char ipv6_unused[16]; if(1 == Curl_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) { diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 3d718b3417..8fed61760b 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -539,7 +539,7 @@ static void compound_results(struct thread_data *res, if(!ai) return; -#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */ +#ifdef USE_IPV6 /* CURLRES_IPV6 */ if(res->temp_ai && res->temp_ai->ai_family == PF_INET6) { /* We have results already, put the new IPv6 entries at the head of the list. */ @@ -684,7 +684,7 @@ static struct Curl_addrinfo *ares2addr(struct ares_addrinfo_node *node) /* settle family-specific sockaddr structure size. */ if(ai->ai_family == AF_INET) ss_size = sizeof(struct sockaddr_in); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(ai->ai_family == AF_INET6) ss_size = sizeof(struct sockaddr_in6); #endif @@ -932,7 +932,7 @@ CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data, CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data, const char *local_ip6) { -#if defined(HAVE_CARES_SET_LOCAL) && defined(ENABLE_IPV6) +#if defined(HAVE_CARES_SET_LOCAL) && defined(USE_IPV6) unsigned char a6[INET6_ADDRSTRLEN]; if((!local_ip6) || (local_ip6[0] == 0)) { diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 5b9d5049fc..87d34a7e43 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -325,7 +325,7 @@ query_complete(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlapped) /* settle family-specific sockaddr structure size. */ if(ai->ai_family == AF_INET) ss_size = sizeof(struct sockaddr_in); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(ai->ai_family == AF_INET6) ss_size = sizeof(struct sockaddr_in6); #endif @@ -444,7 +444,7 @@ query_complete(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlapped) /* * getaddrinfo_thread() resolves a name and then exits. * - * For builds without ARES, but with ENABLE_IPV6, create a resolver thread + * For builds without ARES, but with USE_IPV6, create a resolver thread * and wait on it. */ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg) diff --git a/lib/cf-socket.c b/lib/cf-socket.c index a5feb6b95a..eeae5f9950 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -81,7 +81,7 @@ #include "memdebug.h" -#if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY) && defined(_WIN32) +#if defined(USE_IPV6) && defined(IPV6_V6ONLY) && defined(_WIN32) /* It makes support for IPv4-mapped IPv6 addresses. * Linux kernel, NetBSD, FreeBSD and Darwin: default is off; * Windows Vista and later: default is on; @@ -287,7 +287,7 @@ static CURLcode socket_open(struct Curl_easy *data, /* no socket, no connection */ return CURLE_COULDNT_CONNECT; -#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) +#if defined(USE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) if(data->conn->scope_id && (addr->family == AF_INET6)) { struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr; sa6->sin6_scope_id = data->conn->scope_id; @@ -405,7 +405,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, struct sockaddr *sock = (struct sockaddr *)&sa; /* bind to this address */ curl_socklen_t sizeof_sa = 0; /* size of the data sock points to */ struct sockaddr_in *si4 = (struct sockaddr_in *)&sa; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa; #endif @@ -419,7 +419,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, #ifdef IP_BIND_ADDRESS_NO_PORT int on = 1; #endif -#ifndef ENABLE_IPV6 +#ifndef USE_IPV6 (void)scope; #endif @@ -475,7 +475,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, #endif switch(Curl_if2ip(af, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 scope, conn->scope_id, #endif dev, myhost, sizeof(myhost))) { @@ -514,7 +514,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, if(af == AF_INET) conn->ip_version = CURL_IPRESOLVE_V4; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(af == AF_INET6) conn->ip_version = CURL_IPRESOLVE_V6; #endif @@ -547,7 +547,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, } if(done > 0) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* IPv6 address */ if(af == AF_INET6) { #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID @@ -596,7 +596,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, } else { /* no device was given, prepare sa to match af's needs */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(af == AF_INET6) { si6->sin6_family = AF_INET6; si6->sin6_port = htons(port); @@ -639,7 +639,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, /* We reuse/clobber the port variable here below */ if(sock->sa_family == AF_INET) si4->sin_port = ntohs(port); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else si6->sin6_port = ntohs(port); #endif @@ -991,7 +991,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf, if(result) goto out; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(ctx->addr.family == AF_INET6) { set_ipv6_v6only(ctx->sock, 0); infof(data, " Trying [%s]:%d...", ctx->ip.remote_ip, ctx->ip.remote_port); @@ -1000,7 +1000,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf, #endif infof(data, " Trying %s:%d...", ctx->ip.remote_ip, ctx->ip.remote_port); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 is_tcp = (ctx->addr.family == AF_INET || ctx->addr.family == AF_INET6) && ctx->addr.socktype == SOCK_STREAM; @@ -1037,7 +1037,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf, #ifndef CURL_DISABLE_BINDLOCAL /* possibly bind the local end to an IP, interface or port */ if(ctx->addr.family == AF_INET -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 || ctx->addr.family == AF_INET6 #endif ) { @@ -1449,7 +1449,7 @@ static void cf_socket_active(struct Curl_cfilter *cf, struct Curl_easy *data) /* the first socket info gets some specials */ if(cf->sockindex == FIRSTSOCKET) { cf->conn->remote_addr = &ctx->addr; - #ifdef ENABLE_IPV6 + #ifdef USE_IPV6 cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE; #endif Curl_persistconninfo(data, cf->conn, &ctx->ip); diff --git a/lib/config-os400.h b/lib/config-os400.h index 32852bb378..be531f39e1 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -57,7 +57,7 @@ #undef NEED_REENTRANT /* Define if you want to enable IPv6 support */ -#define ENABLE_IPV6 +#define USE_IPV6 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 diff --git a/lib/config-plan9.h b/lib/config-plan9.h index aa9623f922..6f3a15a5ef 100644 --- a/lib/config-plan9.h +++ b/lib/config-plan9.h @@ -28,7 +28,7 @@ #define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem" #define CURL_CA_PATH "/sys/lib/tls" #define CURL_STATICLIB 1 -#define ENABLE_IPV6 1 +#define USE_IPV6 1 #define CURL_DISABLE_LDAP 1 #define NEED_REENTRANT 1 diff --git a/lib/config-riscos.h b/lib/config-riscos.h index f3a8e68321..eb1d26ec77 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -55,7 +55,7 @@ #undef NEED_REENTRANT /* Define if you want to enable IPv6 support */ -#undef ENABLE_IPV6 +#undef USE_IPV6 /* Define if struct sockaddr_in6 has the sin6_scope_id member */ #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 @@ -66,9 +66,6 @@ /* Define this as a suitable file to read random data from */ #undef RANDOM_FILE -/* Define if you want to enable IPv6 support */ -#undef ENABLE_IPV6 - /* Define if you have the alarm function. */ #define HAVE_ALARM diff --git a/lib/config-win32.h b/lib/config-win32.h index 89ed1a0f16..d1341933b3 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -509,8 +509,4 @@ Vista /* If you want to build curl with the built-in manual */ #define USE_MANUAL 1 -#if defined(USE_IPV6) -# define ENABLE_IPV6 1 -#endif - #endif /* HEADER_CURL_CONFIG_WIN32_H */ diff --git a/lib/conncache.c b/lib/conncache.c index 11dd8e8ca9..da9c4f032a 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -140,7 +140,7 @@ static void hashkey(struct connectdata *conn, char *buf, size_t len) hostname = conn->host.name; /* put the numbers first so that the hostname gets cut off if too long */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname); #else msnprintf(buf, len, "%ld/%s", port, hostname); diff --git a/lib/connect.c b/lib/connect.c index e457006c06..4a130f0616 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -195,7 +195,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, char *addr, int *port) { struct sockaddr_in *si = NULL; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 *si6 = NULL; #endif #if (defined(HAVE_SYS_UN_H) || defined(WIN32_SOCKADDR_UN)) && defined(AF_UNIX) @@ -214,7 +214,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, return TRUE; } break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: si6 = (struct sockaddr_in6 *)(void *) sa; if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, @@ -401,7 +401,7 @@ static CURLcode eyeballer_new(struct eyeballer **pballer, return CURLE_OUT_OF_MEMORY; baller->name = ((ai_family == AF_INET)? "ipv4" : ( -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 (ai_family == AF_INET6)? "ipv6" : #endif "ip")); @@ -779,7 +779,7 @@ static CURLcode start_connect(struct Curl_cfilter *cf, /* any IP version is allowed */ ai_family0 = remotehost->addr? remotehost->addr->ai_family : 0; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ai_family1 = ai_family0 == AF_INET6 ? AF_INET : AF_INET6; #else @@ -790,7 +790,7 @@ static CURLcode start_connect(struct Curl_cfilter *cf, /* only one IP version is allowed */ ai_family0 = (conn->ip_version == CURL_IPRESOLVE_V4) ? AF_INET : -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 AF_INET6; #else AF_UNSPEC; diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index f9211d3f57..c32f24d018 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -130,7 +130,7 @@ Curl_getaddrinfo_ex(const char *nodename, /* settle family-specific sockaddr structure size. */ if(ai->ai_family == AF_INET) ss_size = sizeof(struct sockaddr_in); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(ai->ai_family == AF_INET6) ss_size = sizeof(struct sockaddr_in6); #endif @@ -259,7 +259,7 @@ Curl_he2ai(const struct hostent *he, int port) struct Curl_addrinfo *prevai = NULL; struct Curl_addrinfo *firstai = NULL; struct sockaddr_in *addr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 *addr6; #endif CURLcode result = CURLE_OK; @@ -275,7 +275,7 @@ Curl_he2ai(const struct hostent *he, int port) for(i = 0; (curr = he->h_addr_list[i]) != NULL; i++) { size_t ss_size; size_t namelen = strlen(he->h_name) + 1; /* include null-terminator */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(he->h_addrtype == AF_INET6) ss_size = sizeof(struct sockaddr_in6); else @@ -321,7 +321,7 @@ Curl_he2ai(const struct hostent *he, int port) addr->sin_port = htons((unsigned short)port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: addr6 = (void *)ai->ai_addr; /* storage area for this info */ @@ -348,7 +348,7 @@ struct namebuff { struct hostent hostentry; union { struct in_addr ina4; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct in6_addr ina6; #endif } addrentry; @@ -401,7 +401,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) addrentry = (void *)&buf->addrentry.ina4; memcpy(addrentry, inaddr, sizeof(struct in_addr)); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: addrsize = sizeof(struct in6_addr); addrentry = (void *)&buf->addrentry.ina6; @@ -447,7 +447,7 @@ struct Curl_addrinfo *Curl_str2addr(char *address, int port) if(Curl_inet_pton(AF_INET, address, &in) > 0) /* This is a dotted IP address 123.123.123.123-style */ return Curl_ip2addr(AF_INET, &in, address, port); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 { struct in6_addr in6; if(Curl_inet_pton(AF_INET6, address, &in6) > 0) @@ -570,7 +570,7 @@ void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port) { struct Curl_addrinfo *ca; struct sockaddr_in *addr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 *addr6; #endif for(ca = addrinfo; ca != NULL; ca = ca->ai_next) { @@ -580,7 +580,7 @@ void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port) addr->sin_port = htons((unsigned short)port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: addr6 = (void *)ca->ai_addr; /* storage area for this info */ addr6->sin6_port = htons((unsigned short)port); diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index dbdd04b5ad..f624da5f82 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -163,7 +163,7 @@ #cmakedefine USE_WIN32_LDAP 1 /* Define if you want to enable IPv6 support */ -#cmakedefine ENABLE_IPV6 1 +#cmakedefine USE_IPV6 1 /* Define to 1 if you have the alarm function. */ #cmakedefine HAVE_ALARM 1 diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 51f082ff61..c2d656be17 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -72,6 +72,11 @@ # endif #endif +/* Compatibility */ +#if defined(ENABLE_IPV6) +# define USE_IPV6 1 +#endif + /* * Include configuration script results or hand-crafted * configuration file for platforms which lack config tool. @@ -309,7 +314,7 @@ #include #define USE_RESOLVE_ON_IPS 1 # if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \ - defined(ENABLE_IPV6) + defined(USE_IPV6) # define CURL_MACOS_CALL_COPYPROXIES 1 # endif #endif @@ -620,9 +625,9 @@ * Mutually exclusive CURLRES_* definitions. */ -#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO) +#if defined(USE_IPV6) && defined(HAVE_GETADDRINFO) # define CURLRES_IPV6 -#elif defined(ENABLE_IPV6) && (defined(_WIN32) || defined(__CYGWIN__)) +#elif defined(USE_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 diff --git a/lib/doh.c b/lib/doh.c index 33e714166a..363c1fb6f6 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -408,7 +408,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data, goto error; dohp->pending++; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if((conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) { /* create IPv6 DoH request */ result = dohprobe(data, &dohp->probe[DOH_PROBE_SLOT_IPADDR_V6], @@ -804,7 +804,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname, struct Curl_addrinfo *prevai = NULL; struct Curl_addrinfo *firstai = NULL; struct sockaddr_in *addr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 *addr6; #endif CURLcode result = CURLE_OK; @@ -820,7 +820,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname, size_t ss_size; CURL_SA_FAMILY_T addrtype; if(de->addr[i].type == DNS_TYPE_AAAA) { -#ifndef ENABLE_IPV6 +#ifndef USE_IPV6 /* we can't handle IPv6 addresses */ continue; #else @@ -869,7 +869,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname, addr->sin_port = htons((unsigned short)port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: addr6 = (void *)ai->ai_addr; /* storage area for this info */ DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6)); diff --git a/lib/ftp.c b/lib/ftp.c index 760b54ff3b..648cab3f6e 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -362,7 +362,7 @@ static CURLcode AcceptServerConnect(struct Curl_easy *data) struct connectdata *conn = data->conn; curl_socket_t sock = conn->sock[SECONDARYSOCKET]; curl_socket_t s = CURL_SOCKET_BAD; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct Curl_sockaddr_storage add; #else struct sockaddr_in add; @@ -1029,7 +1029,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, char hbuf[NI_MAXHOST]; struct sockaddr *sa = (struct sockaddr *)&ss; struct sockaddr_in * const sa4 = (void *)sa; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 * const sa6 = (void *)sa; #endif static const char mode[][5] = { "EPRT", "PORT" }; @@ -1056,7 +1056,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, (strlen(data->set.str[STRING_FTPPORT]) > 1)) { char *ip_end = NULL; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(*string_ftpport == '[') { /* [ipv6]:port(-range) */ char *ip_start = string_ftpport + 1; @@ -1078,7 +1078,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, if(ip_end) { /* either ipv6 or (ipv4|domain|interface):port(-range) */ addrlen = ip_end - string_ftpport; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(Curl_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) { /* ipv6 */ port_min = port_max = 0; @@ -1124,7 +1124,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, /* attempt to get the address of the given interface name */ switch(Curl_if2ip(conn->remote_addr->family, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 Curl_ipv6_scope(&conn->remote_addr->sa_addr), conn->scope_id, #endif @@ -1156,7 +1156,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, goto out; } switch(sa->sa_family) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); break; @@ -1216,7 +1216,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, for(port = port_min; port <= port_max;) { if(sa->sa_family == AF_INET) sa4->sin_port = htons(port); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else sa6->sin6_port = htons(port); #endif @@ -1284,7 +1284,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, below */ Curl_printable_address(ai, myhost, sizeof(myhost)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!conn->bits.ftp_use_eprt && conn->bits.ipv6) /* EPRT is disabled but we are connected to a IPv6 host, so we ignore the request and enable EPRT again! */ @@ -1311,7 +1311,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, case AF_INET: port = ntohs(sa4->sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: port = ntohs(sa6->sin6_port); break; diff --git a/lib/hostip.c b/lib/hostip.c index 442817d119..8f13a7c73e 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -144,7 +144,7 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, (void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize); break; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: { const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr; const struct in6_addr *ipaddr6 = &sa6->sin6_addr; @@ -523,7 +523,7 @@ Curl_cache_addr(struct Curl_easy *data, return dns; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* return a static IPv6 ::1 for the name */ static struct Curl_addrinfo *get_localhost6(int port, const char *name) { @@ -600,7 +600,7 @@ static struct Curl_addrinfo *get_localhost(int port, const char *name) return ca6; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* * Curl_ipv6works() returns TRUE if IPv6 seems to work. */ @@ -632,7 +632,7 @@ bool Curl_ipv6works(struct Curl_easy *data) return (ipv6_works>0)?TRUE:FALSE; } } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ /* * Curl_host_is_ipnum() returns TRUE if the given string is a numerical IPv4 @@ -641,11 +641,11 @@ bool Curl_ipv6works(struct Curl_easy *data) bool Curl_host_is_ipnum(const char *hostname) { struct in_addr in; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct in6_addr in6; #endif if(Curl_inet_pton(AF_INET, hostname, &in) > 0 -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 || Curl_inet_pton(AF_INET6, hostname, &in6) > 0 #endif ) @@ -760,7 +760,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, if(!addr) return CURLRESOLV_ERROR; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else { struct in6_addr in6; /* check if this is an IPv6 address string */ @@ -771,7 +771,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, return CURLRESOLV_ERROR; } } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ #else /* if USE_RESOLVE_ON_IPS */ #ifndef CURL_DISABLE_DOH @@ -779,7 +779,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, if(Curl_inet_pton(AF_INET, hostname, &in) > 0) /* This is a dotted IP address 123.123.123.123-style */ ipnum = TRUE; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else { struct in6_addr in6; /* check if this is an IPv6 address string */ @@ -787,7 +787,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, /* This is an IPv6 address literal */ ipnum = TRUE; } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ #endif /* CURL_DISABLE_DOH */ #endif /* !USE_RESOLVE_ON_IPS */ @@ -1210,7 +1210,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) memcpy(address, addr_begin, alen); address[alen] = '\0'; -#ifndef ENABLE_IPV6 +#ifndef USE_IPV6 if(strchr(address, ':')) { infof(data, "Ignoring resolve address '%s', missing IPv6 support.", address); diff --git a/lib/hostip.h b/lib/hostip.h index fb53a5776b..eee86bdf85 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -96,7 +96,7 @@ enum resolve_t Curl_resolv_timeout(struct Curl_easy *data, struct Curl_dns_entry **dnsentry, timediff_t timeoutms); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* * Curl_ipv6works() returns TRUE if IPv6 seems to work. */ diff --git a/lib/if2ip.c b/lib/if2ip.c index 5249f6cc7e..36dfe8b396 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -62,7 +62,7 @@ /* ------------------------------------------------------------------ */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* Return the scope of the given address. */ unsigned int Curl_ipv6_scope(const struct sockaddr *sa) { @@ -97,7 +97,7 @@ unsigned int Curl_ipv6_scope(const struct sockaddr *sa) #if defined(HAVE_GETIFADDRS) if2ip_result_t Curl_if2ip(int af, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int remote_scope, unsigned int local_scope_id, #endif @@ -107,7 +107,7 @@ if2ip_result_t Curl_if2ip(int af, struct ifaddrs *iface, *head; if2ip_result_t res = IF2IP_NOT_FOUND; -#if defined(ENABLE_IPV6) && \ +#if defined(USE_IPV6) && \ !defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID) (void) local_scope_id; #endif @@ -121,7 +121,7 @@ if2ip_result_t Curl_if2ip(int af, const char *ip; char scope[12] = ""; char ipstr[64]; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(af == AF_INET6) { #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID unsigned int scopeid = 0; @@ -182,7 +182,7 @@ if2ip_result_t Curl_if2ip(int af, #elif defined(HAVE_IOCTL_SIOCGIFADDR) if2ip_result_t Curl_if2ip(int af, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int remote_scope, unsigned int local_scope_id, #endif @@ -196,7 +196,7 @@ if2ip_result_t Curl_if2ip(int af, size_t len; const char *r; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 (void)remote_scope; (void)local_scope_id; #endif @@ -237,7 +237,7 @@ if2ip_result_t Curl_if2ip(int af, #else if2ip_result_t Curl_if2ip(int af, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int remote_scope, unsigned int local_scope_id, #endif @@ -245,7 +245,7 @@ if2ip_result_t Curl_if2ip(int af, char *buf, int buf_size) { (void) af; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 (void) remote_scope; (void) local_scope_id; #endif diff --git a/lib/if2ip.h b/lib/if2ip.h index 1f973505c0..e251d1ddfc 100644 --- a/lib/if2ip.h +++ b/lib/if2ip.h @@ -32,7 +32,7 @@ #define IPV6_SCOPE_UNIQUELOCAL 3 /* Unique local */ #define IPV6_SCOPE_NODELOCAL 4 /* Loopback. */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int Curl_ipv6_scope(const struct sockaddr *sa); #else #define Curl_ipv6_scope(x) 0 @@ -45,7 +45,7 @@ typedef enum { } if2ip_result_t; if2ip_result_t Curl_if2ip(int af, -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int remote_scope, unsigned int local_scope_id, #endif diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index c9cee0c578..4520b87150 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -42,11 +42,11 @@ #define INT16SZ 2 /* - * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make + * If USE_IPV6 is disabled, we still want to parse IPv6 addresses, so make * sure we have _some_ value for AF_INET6 without polluting our fake value * everywhere. */ -#if !defined(ENABLE_IPV6) && !defined(AF_INET6) +#if !defined(USE_IPV6) && !defined(AF_INET6) #define AF_INET6 (AF_INET + 1) #endif diff --git a/lib/inet_pton.c b/lib/inet_pton.c index 176cc956fe..9cfcec1c9a 100644 --- a/lib/inet_pton.c +++ b/lib/inet_pton.c @@ -39,11 +39,11 @@ #define INT16SZ 2 /* - * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make + * If USE_IPV6 is disabled, we still want to parse IPv6 addresses, so make * sure we have _some_ value for AF_INET6 without polluting our fake value * everywhere. */ -#if !defined(ENABLE_IPV6) && !defined(AF_INET6) +#if !defined(USE_IPV6) && !defined(AF_INET6) #define AF_INET6 (AF_INET + 1) #endif diff --git a/lib/noproxy.c b/lib/noproxy.c index 5241640a36..62299e28f3 100644 --- a/lib/noproxy.c +++ b/lib/noproxy.c @@ -78,7 +78,7 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6, const char *network, unsigned int bits) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 int bytes; int rest; unsigned char address[16]; diff --git a/lib/setopt.c b/lib/setopt.c index b36d9bd2c5..0d06ecec35 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -2634,7 +2634,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) break; #endif -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case CURLOPT_ADDRESS_SCOPE: /* * Use this scope id when using IPv6 diff --git a/lib/setup-vms.h b/lib/setup-vms.h index 645cc1a9cd..ea3936c708 100644 --- a/lib/setup-vms.h +++ b/lib/setup-vms.h @@ -374,8 +374,8 @@ static struct passwd *vms_getpwuid(uid_t uid) #ifdef HAVE_NETDB_H #include #ifndef AI_NUMERICHOST -#ifdef ENABLE_IPV6 -#undef ENABLE_IPV6 +#ifdef USE_IPV6 +#undef USE_IPV6 #endif #endif #endif diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 5a6bb207dc..2e2d375e06 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -30,7 +30,7 @@ struct Curl_sockaddr_storage { union { struct sockaddr sa; struct sockaddr_in sa_in; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 sa_in6; #endif #ifdef HAVE_STRUCT_SOCKADDR_STORAGE diff --git a/lib/socks.c b/lib/socks.c index e6c6a6480f..4ade4eb020 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -838,7 +838,7 @@ CONNECT_RESOLVED: struct Curl_addrinfo *hp = NULL; if(dns) hp = dns->addr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(data->set.ipver != CURL_IPRESOLVE_WHATEVER) { int wanted_family = data->set.ipver == CURL_IPRESOLVE_V4 ? AF_INET : AF_INET6; @@ -872,7 +872,7 @@ CONNECT_RESOLVED: infof(data, "SOCKS5 connect to %s:%d (locally resolved)", dest, sx->remote_port); } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(hp->ai_family == AF_INET6) { int i; struct sockaddr_in6 *saddr_in6; @@ -909,7 +909,7 @@ CONNECT_RESOLVE_REMOTE: IPv6 == 4, IPv4 == 1 */ unsigned char ip4[4]; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(conn->bits.ipv6_ip) { char ip6[16]; if(1 != Curl_inet_pton(AF_INET6, sx->hostname, ip6)) diff --git a/lib/url.c b/lib/url.c index b2f501b245..5c04153744 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1715,7 +1715,7 @@ CURLcode Curl_uc_to_curlcode(CURLUcode uc) } } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 /* * If the URL was set with an IPv6 numerical address with a zone id part, set * the scope_id based on that! @@ -1980,7 +1980,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, (void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(data->set.scope_id) /* Override any scope that was set above. */ conn->scope_id = data->set.scope_id; @@ -2887,7 +2887,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data, /* detect and extract RFC6874-style IPv6-addresses */ if(*hostptr == '[') { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 char *ptr = ++hostptr; /* advance beyond the initial bracket */ while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '.'))) ptr++; diff --git a/lib/urlapi.c b/lib/urlapi.c index dc42489722..e610d97964 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -59,11 +59,11 @@ #define MAX_SCHEME_LEN 40 /* - * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make + * If USE_IPV6 is disabled, we still want to parse IPv6 addresses, so make * sure we have _some_ value for AF_INET6 without polluting our fake value * everywhere. */ -#if !defined(ENABLE_IPV6) && !defined(AF_INET6) +#if !defined(USE_IPV6) && !defined(AF_INET6) #define AF_INET6 (AF_INET + 1) #endif diff --git a/lib/urldata.h b/lib/urldata.h index 03f883496d..ce16503fd1 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -984,7 +984,7 @@ struct connectdata { int remote_port; /* the remote port, not the proxy port! */ int conn_to_port; /* the remote port to connect to. valid only if bits.conn_to_port is set */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int scope_id; /* Scope id for IPv6 */ #endif unsigned short localport; @@ -1706,7 +1706,7 @@ struct UserDefined { unsigned int new_file_perms; /* when creating remote files */ char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */ struct curl_blob *blobs[BLOB_LAST]; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 unsigned int scope_id; /* Scope id for IPv6 */ #endif curl_prot_t allowed_protocols; diff --git a/lib/version.c b/lib/version.c index 942cf56130..7ab67f83b0 100644 --- a/lib/version.c +++ b/lib/version.c @@ -478,7 +478,7 @@ static const struct feat features_table[] = { #if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) FEATURE("IDN", idn_present, CURL_VERSION_IDN), #endif -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 FEATURE("IPv6", NULL, CURL_VERSION_IPV6), #endif #ifdef USE_KERBEROS5 diff --git a/lib/vquic/curl_osslq.c b/lib/vquic/curl_osslq.c index b7ca302230..dffd96339a 100644 --- a/lib/vquic/curl_osslq.c +++ b/lib/vquic/curl_osslq.c @@ -182,7 +182,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr, result = CURLE_OK; break; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: { struct sockaddr_in6 * const sin = (struct sockaddr_in6 * const)(void *)&addr->sa_addr; @@ -192,7 +192,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr, result = CURLE_OK; break; } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ default: /* sunsupported */ DEBUGASSERT(0); diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index bd9c6239d0..a0d1fccfb8 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -1204,7 +1204,7 @@ Curl_gtls_verifyserver(struct Curl_easy *data, /* Before 3.3.6, gnutls_x509_crt_check_hostname() didn't check IP addresses. */ if(!rc) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 #define use_addr in6_addr #else #define use_addr in_addr @@ -1214,7 +1214,7 @@ Curl_gtls_verifyserver(struct Curl_easy *data, if(Curl_inet_pton(AF_INET, peer->hostname, addrbuf) > 0) addrlen = 4; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(Curl_inet_pton(AF_INET6, peer->hostname, addrbuf) > 0) addrlen = 16; #endif diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 0c5660f6cf..eada3c398f 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -2147,7 +2147,7 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn, int target; /* target type, GEN_DNS or GEN_IPADD */ size_t addrlen = 0; STACK_OF(GENERAL_NAME) *altnames; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct in6_addr addr; #else struct in_addr addr; @@ -2166,7 +2166,7 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn, target = GEN_IPADD; addrlen = sizeof(struct in_addr); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case CURL_SSL_PEER_IPV6: if(!Curl_inet_pton(AF_INET6, peer->hostname, &addr)) return CURLE_PEER_FAILED_VERIFICATION; diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c index ceb26c5bd9..cb25c5234c 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -357,12 +357,12 @@ static bool cr_hostname_is_ip(const char *hostname) { struct in_addr in; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct in6_addr in6; if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) { return true; } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(Curl_inet_pton(AF_INET, hostname, &in) > 0) { return true; } diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 28d1595390..c14b398274 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1534,14 +1534,14 @@ static void cf_close(struct Curl_cfilter *cf, struct Curl_easy *data) static ssl_peer_type get_peer_type(const char *hostname) { if(hostname && hostname[0]) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct in6_addr addr; #else struct in_addr addr; #endif if(Curl_inet_pton(AF_INET, hostname, &addr)) return CURL_SSL_PEER_IPV4; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else if(Curl_inet_pton(AF_INET6, hostname, &addr)) { return CURL_SSL_PEER_IPV6; } diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index 38918a065d..31918956b7 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -119,7 +119,7 @@ static const char *configfile = DEFAULT_CONFIG; static const char *logdir = "log"; static char loglockfile[256]; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 static bool use_ipv6 = FALSE; #endif static const char *ipv_inuse = "IPv4"; @@ -838,7 +838,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, /* When the specified listener port is zero, it is actually a request to let the system choose a non-zero available port. */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif memset(&listener.sa4, 0, sizeof(listener.sa4)); @@ -846,7 +846,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa4.sin_addr.s_addr = INADDR_ANY; listener.sa4.sin_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa4)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { memset(&listener.sa6, 0, sizeof(listener.sa6)); @@ -855,7 +855,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa6.sin6_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa6)); } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(rc) { error = SOCKERRNO; logmsg("Error binding socket on port %hu: (%d) %s", @@ -869,11 +869,11 @@ static curl_socket_t sockdaemon(curl_socket_t sock, port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif la_size = sizeof(localaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else la_size = sizeof(localaddr.sa6); #endif @@ -889,7 +889,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, case AF_INET: *listenport = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: *listenport = ntohs(localaddr.sa6.sin6_port); break; @@ -937,7 +937,7 @@ int main(int argc, char *argv[]) while(argc>arg) { if(!strcmp("--version", argv[arg])) { printf("mqttd IPv4%s\n", -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #else "" @@ -971,7 +971,7 @@ int main(int argc, char *argv[]) logdir = argv[arg++]; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv6"; use_ipv6 = TRUE; #endif @@ -979,7 +979,7 @@ int main(int argc, char *argv[]) } else if(!strcmp("--ipv4", argv[arg])) { /* for completeness, we support this option as well */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv4"; use_ipv6 = FALSE; #endif @@ -1029,11 +1029,11 @@ int main(int argc, char *argv[]) install_signal_handlers(FALSE); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif sock = socket(AF_INET, SOCK_STREAM, 0); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else sock = socket(AF_INET6, SOCK_STREAM, 0); #endif diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 9c01ce8713..6aac06ae62 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -64,7 +64,7 @@ #define ERANGE 34 /* errno.h value */ #endif -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 static bool use_ipv6 = FALSE; #endif static const char *ipv_inuse = "IPv4"; @@ -1074,7 +1074,7 @@ int main(int argc, char *argv[]) printf("rtspd IPv4%s" "\n" , -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #else "" @@ -1103,14 +1103,14 @@ int main(int argc, char *argv[]) logdir = argv[arg++]; } else if(!strcmp("--ipv4", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv4"; use_ipv6 = FALSE; #endif arg++; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv6"; use_ipv6 = TRUE; #endif @@ -1157,11 +1157,11 @@ int main(int argc, char *argv[]) install_signal_handlers(false); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif sock = socket(AF_INET, SOCK_STREAM, 0); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else sock = socket(AF_INET6, SOCK_STREAM, 0); #endif @@ -1181,7 +1181,7 @@ int main(int argc, char *argv[]) goto server_cleanup; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif memset(&me.sa4, 0, sizeof(me.sa4)); @@ -1189,7 +1189,7 @@ int main(int argc, char *argv[]) me.sa4.sin_addr.s_addr = INADDR_ANY; me.sa4.sin_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa4)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { memset(&me.sa6, 0, sizeof(me.sa6)); @@ -1198,7 +1198,7 @@ int main(int argc, char *argv[]) me.sa6.sin6_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa6)); } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(0 != rc) { error = SOCKERRNO; logmsg("Error binding socket on port %hu: (%d) %s", @@ -1211,11 +1211,11 @@ int main(int argc, char *argv[]) port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif la_size = sizeof(localaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else la_size = sizeof(localaddr.sa6); #endif @@ -1231,7 +1231,7 @@ int main(int argc, char *argv[]) case AF_INET: port = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: port = ntohs(localaddr.sa6.sin6_port); break; diff --git a/tests/server/server_sockaddr.h b/tests/server/server_sockaddr.h index c48c7c7c38..fb4609976a 100644 --- a/tests/server/server_sockaddr.h +++ b/tests/server/server_sockaddr.h @@ -32,7 +32,7 @@ typedef union { struct sockaddr sa; struct sockaddr_in sa4; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 struct sockaddr_in6 sa6; #endif #ifdef USE_UNIX_SOCKETS diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index dcfad55544..27e0ebfed2 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -138,7 +138,7 @@ const char *serverlogfile = DEFAULT_LOGFILE; static bool verbose = FALSE; static bool bind_only = FALSE; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 static bool use_ipv6 = FALSE; #endif static const char *ipv_inuse = "IPv4"; @@ -1255,7 +1255,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, /* When the specified listener port is zero, it is actually a request to let the system choose a non-zero available port. */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif memset(&listener.sa4, 0, sizeof(listener.sa4)); @@ -1263,7 +1263,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa4.sin_addr.s_addr = INADDR_ANY; listener.sa4.sin_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa4)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { memset(&listener.sa6, 0, sizeof(listener.sa6)); @@ -1272,7 +1272,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa6.sin6_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa6)); } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(rc) { error = SOCKERRNO; logmsg("Error binding socket on port %hu: (%d) %s", @@ -1286,11 +1286,11 @@ static curl_socket_t sockdaemon(curl_socket_t sock, port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif la_size = sizeof(localaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else la_size = sizeof(localaddr.sa6); #endif @@ -1306,7 +1306,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, case AF_INET: *listenport = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: *listenport = ntohs(localaddr.sa6.sin6_port); break; @@ -1364,7 +1364,7 @@ int main(int argc, char *argv[]) while(argc>arg) { if(!strcmp("--version", argv[arg])) { printf("sockfilt IPv4%s\n", -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #else "" @@ -1392,7 +1392,7 @@ int main(int argc, char *argv[]) serverlogfile = argv[arg++]; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv6"; use_ipv6 = TRUE; #endif @@ -1400,7 +1400,7 @@ int main(int argc, char *argv[]) } else if(!strcmp("--ipv4", argv[arg])) { /* for completeness, we support this option as well */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv4"; use_ipv6 = FALSE; #endif @@ -1472,11 +1472,11 @@ int main(int argc, char *argv[]) install_signal_handlers(false); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif sock = socket(AF_INET, SOCK_STREAM, 0); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else sock = socket(AF_INET6, SOCK_STREAM, 0); #endif @@ -1491,7 +1491,7 @@ int main(int argc, char *argv[]) if(connectport) { /* Active mode, we should connect to the given port number */ mode = ACTIVE; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif memset(&me.sa4, 0, sizeof(me.sa4)); @@ -1503,7 +1503,7 @@ int main(int argc, char *argv[]) Curl_inet_pton(AF_INET, addr, &me.sa4.sin_addr); rc = connect(sock, &me.sa, sizeof(me.sa4)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { memset(&me.sa6, 0, sizeof(me.sa6)); @@ -1515,7 +1515,7 @@ int main(int argc, char *argv[]) rc = connect(sock, &me.sa, sizeof(me.sa6)); } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(rc) { error = SOCKERRNO; logmsg("Error connecting to port %hu: (%d) %s", diff --git a/tests/server/socksd.c b/tests/server/socksd.c index b1d8220a3a..39007e5d72 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -176,7 +176,7 @@ static unsigned short shortval(char *value) static enum { socket_domain_inet = AF_INET -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 , socket_domain_inet6 = AF_INET6 #endif #ifdef USE_UNIX_SOCKETS @@ -865,7 +865,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa4.sin_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa4)); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: memset(&listener.sa6, 0, sizeof(listener.sa6)); listener.sa6.sin6_family = AF_INET6; @@ -873,7 +873,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, listener.sa6.sin6_port = htons(*listenport); rc = bind(sock, &listener.sa, sizeof(listener.sa6)); break; -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ #ifdef USE_UNIX_SOCKETS case AF_UNIX: rc = bind_unix_socket(sock, unix_socket, &listener.sau); @@ -903,7 +903,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(socket_domain == AF_INET6) la_size = sizeof(localaddr.sa6); else @@ -921,7 +921,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, case AF_INET: *listenport = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: *listenport = ntohs(localaddr.sa6.sin6_port); break; @@ -974,7 +974,7 @@ int main(int argc, char *argv[]) while(argc>arg) { if(!strcmp("--version", argv[arg])) { printf("socksd IPv4%s\n", -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #else "" @@ -1018,7 +1018,7 @@ int main(int argc, char *argv[]) reqlogfile = argv[arg++]; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 socket_domain = AF_INET6; socket_type = "IPv6"; #endif @@ -1026,7 +1026,7 @@ int main(int argc, char *argv[]) } else if(!strcmp("--ipv4", argv[arg])) { /* for completeness, we support this option as well */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 socket_type = "IPv4"; #endif arg++; diff --git a/tests/server/sws.c b/tests/server/sws.c index d912585977..53add587d6 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -70,7 +70,7 @@ static enum { socket_domain_inet = AF_INET -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 , socket_domain_inet6 = AF_INET6 #endif #ifdef USE_UNIX_SOCKETS @@ -229,7 +229,7 @@ static bool socket_domain_is_ip(void) { switch(socket_domain) { case AF_INET: -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: #endif return true; @@ -1290,7 +1290,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) const char *op_br = ""; const char *cl_br = ""; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(socket_domain == AF_INET6) { op_br = "["; cl_br = "]"; @@ -1335,7 +1335,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) rc = connect(serverfd, &serveraddr.sa, sizeof(serveraddr.sa4)); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: memset(&serveraddr.sa6, 0, sizeof(serveraddr.sa6)); serveraddr.sa6.sin6_family = AF_INET6; @@ -1348,7 +1348,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port) rc = connect(serverfd, &serveraddr.sa, sizeof(serveraddr.sa6)); break; -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ #ifdef USE_UNIX_SOCKETS case AF_UNIX: logmsg("Proxying through Unix socket is not (yet?) supported."); @@ -1976,7 +1976,7 @@ int main(int argc, char *argv[]) while(argc>arg) { if(!strcmp("--version", argv[arg])) { puts("sws IPv4" -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #endif #ifdef USE_UNIX_SOCKETS @@ -2023,7 +2023,7 @@ int main(int argc, char *argv[]) arg++; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 socket_type = "IPv6"; socket_domain = AF_INET6; location_str = port_str; @@ -2164,7 +2164,7 @@ int main(int argc, char *argv[]) me.sa4.sin_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa4)); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: memset(&me.sa6, 0, sizeof(me.sa6)); me.sa6.sin6_family = AF_INET6; @@ -2172,7 +2172,7 @@ int main(int argc, char *argv[]) me.sa6.sin6_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa6)); break; -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ #ifdef USE_UNIX_SOCKETS case AF_UNIX: rc = bind_unix_socket(sock, unix_socket, &me.sau); @@ -2196,11 +2196,11 @@ int main(int argc, char *argv[]) port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(socket_domain != AF_INET6) #endif la_size = sizeof(localaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else la_size = sizeof(localaddr.sa6); #endif @@ -2216,7 +2216,7 @@ int main(int argc, char *argv[]) case AF_INET: port = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: port = ntohs(localaddr.sa6.sin6_port); break; diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 9e839eafc4..0ad03c8e81 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -201,7 +201,7 @@ static curl_socket_t peer = CURL_SOCKET_BAD; static unsigned int timeout; static unsigned int maxtimeout = 5 * TIMEOUT; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 static bool use_ipv6 = FALSE; #endif static const char *ipv_inuse = "IPv4"; @@ -530,11 +530,11 @@ static int synchnet(curl_socket_t f /* socket to flush */) #endif if(i) { j++; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif fromaddrlen = sizeof(fromaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else fromaddrlen = sizeof(fromaddr.sa6); #endif @@ -566,7 +566,7 @@ int main(int argc, char **argv) while(argc>arg) { if(!strcmp("--version", argv[arg])) { printf("tftpd IPv4%s\n", -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 "/IPv6" #else "" @@ -595,14 +595,14 @@ int main(int argc, char **argv) logdir = argv[arg++]; } else if(!strcmp("--ipv4", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv4"; use_ipv6 = FALSE; #endif arg++; } else if(!strcmp("--ipv6", argv[arg])) { -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 ipv_inuse = "IPv6"; use_ipv6 = TRUE; #endif @@ -649,11 +649,11 @@ int main(int argc, char **argv) install_signal_handlers(true); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif sock = socket(AF_INET, SOCK_DGRAM, 0); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else sock = socket(AF_INET6, SOCK_DGRAM, 0); #endif @@ -675,7 +675,7 @@ int main(int argc, char **argv) goto tftpd_cleanup; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif memset(&me.sa4, 0, sizeof(me.sa4)); @@ -683,7 +683,7 @@ int main(int argc, char **argv) me.sa4.sin_addr.s_addr = INADDR_ANY; me.sa4.sin_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa4)); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { memset(&me.sa6, 0, sizeof(me.sa6)); @@ -692,7 +692,7 @@ int main(int argc, char **argv) me.sa6.sin6_port = htons(port); rc = bind(sock, &me.sa, sizeof(me.sa6)); } -#endif /* ENABLE_IPV6 */ +#endif /* USE_IPV6 */ if(0 != rc) { error = SOCKERRNO; logmsg("Error binding socket on port %hu: (%d) %s", port, error, @@ -706,11 +706,11 @@ int main(int argc, char **argv) port we actually got and update the listener port value with it. */ curl_socklen_t la_size; srvr_sockaddr_union_t localaddr; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif la_size = sizeof(localaddr.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else la_size = sizeof(localaddr.sa6); #endif @@ -726,7 +726,7 @@ int main(int argc, char **argv) case AF_INET: port = ntohs(localaddr.sa4.sin_port); break; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 case AF_INET6: port = ntohs(localaddr.sa6.sin6_port); break; @@ -763,11 +763,11 @@ int main(int argc, char **argv) for(;;) { fromlen = sizeof(from); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) #endif fromlen = sizeof(from.sa4); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 else fromlen = sizeof(from.sa6); #endif @@ -784,7 +784,7 @@ int main(int argc, char **argv) set_advisor_read_lock(loglockfile); serverlogslocked = 1; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(!use_ipv6) { #endif from.sa4.sin_family = AF_INET; @@ -799,7 +799,7 @@ int main(int argc, char **argv) result = 1; break; } -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 } else { from.sa6.sin6_family = AF_INET6; diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index cd2657147d..ecc1fc931e 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -62,7 +62,7 @@ struct testcase { /* In builds without IPv6 support CURLOPT_RESOLVE should skip over those addresses, so we have to do that as well. */ static const char skip = 0; -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 #define IPV6ONLY(x) x #else #define IPV6ONLY(x) &skip diff --git a/tests/unit/unit2600.c b/tests/unit/unit2600.c index a2089b2755..1cbb9ef281 100644 --- a/tests/unit/unit2600.c +++ b/tests/unit/unit2600.c @@ -193,7 +193,7 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf, ctx->ai_family = ai->ai_family; ctx->transport = transport; ctx->started = Curl_now(); -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 if(ctx->ai_family == AF_INET6) { ctx->stats = ¤t_tr->cf6; ctx->fail_delay_ms = current_tc->cf6_fail_delay_ms; @@ -358,7 +358,7 @@ static struct test_case TEST_CASES[] = { { 2, TURL, "test.com:123:192.0.2.1,192.0.2.2", CURL_IPRESOLVE_WHATEVER, CNCT_TMOT, 150, 200, 200, 2, 0, 400, TC_TMOT, R_FAIL, NULL }, /* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */ -#ifdef ENABLE_IPV6 +#ifdef USE_IPV6 { 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER, CNCT_TMOT, 150, 200, 200, 0, 1, 200, TC_TMOT, R_FAIL, NULL }, /* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */