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
This commit is contained in:
parent
de66e8ad38
commit
e411c98f70
@ -303,6 +303,9 @@ if(ENABLE_IPV6 AND NOT WIN32)
|
|||||||
list(APPEND CURL_LIBS "-framework SystemConfiguration")
|
list(APPEND CURL_LIBS "-framework SystemConfiguration")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
if(ENABLE_IPV6)
|
||||||
|
set(USE_IPV6 ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Perl)
|
find_package(Perl)
|
||||||
|
|
||||||
|
|||||||
@ -1700,7 +1700,7 @@ int main(void)
|
|||||||
|
|
||||||
if test "$ipv6" = yes; then
|
if test "$ipv6" = yes; then
|
||||||
curl_ipv6_msg="enabled"
|
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
|
IPV6_ENABLED=1
|
||||||
AC_SUBST(IPV6_ENABLED)
|
AC_SUBST(IPV6_ENABLED)
|
||||||
|
|
||||||
|
|||||||
@ -254,7 +254,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(findstring -ipv6,$(CFG)),)
|
ifneq ($(findstring -ipv6,$(CFG)),)
|
||||||
CPPFLAGS += -DENABLE_IPV6
|
CPPFLAGS += -DUSE_IPV6
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
|
ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
|
||||||
|
|||||||
@ -252,7 +252,7 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
|
|||||||
CURLcode result = Curl_gmtime(as->expires, &stamp);
|
CURLcode result = Curl_gmtime(as->expires, &stamp);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else {
|
else {
|
||||||
char ipv6_unused[16];
|
char ipv6_unused[16];
|
||||||
if(1 == Curl_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) {
|
if(1 == Curl_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) {
|
||||||
|
|||||||
@ -539,7 +539,7 @@ static void compound_results(struct thread_data *res,
|
|||||||
if(!ai)
|
if(!ai)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
|
#ifdef USE_IPV6 /* CURLRES_IPV6 */
|
||||||
if(res->temp_ai && res->temp_ai->ai_family == PF_INET6) {
|
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
|
/* We have results already, put the new IPv6 entries at the head of the
|
||||||
list. */
|
list. */
|
||||||
@ -684,7 +684,7 @@ static struct Curl_addrinfo *ares2addr(struct ares_addrinfo_node *node)
|
|||||||
/* settle family-specific sockaddr structure size. */
|
/* settle family-specific sockaddr structure size. */
|
||||||
if(ai->ai_family == AF_INET)
|
if(ai->ai_family == AF_INET)
|
||||||
ss_size = sizeof(struct sockaddr_in);
|
ss_size = sizeof(struct sockaddr_in);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(ai->ai_family == AF_INET6)
|
else if(ai->ai_family == AF_INET6)
|
||||||
ss_size = sizeof(struct sockaddr_in6);
|
ss_size = sizeof(struct sockaddr_in6);
|
||||||
#endif
|
#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,
|
CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
|
||||||
const char *local_ip6)
|
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];
|
unsigned char a6[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
if((!local_ip6) || (local_ip6[0] == 0)) {
|
if((!local_ip6) || (local_ip6[0] == 0)) {
|
||||||
|
|||||||
@ -325,7 +325,7 @@ query_complete(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlapped)
|
|||||||
/* settle family-specific sockaddr structure size. */
|
/* settle family-specific sockaddr structure size. */
|
||||||
if(ai->ai_family == AF_INET)
|
if(ai->ai_family == AF_INET)
|
||||||
ss_size = sizeof(struct sockaddr_in);
|
ss_size = sizeof(struct sockaddr_in);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(ai->ai_family == AF_INET6)
|
else if(ai->ai_family == AF_INET6)
|
||||||
ss_size = sizeof(struct sockaddr_in6);
|
ss_size = sizeof(struct sockaddr_in6);
|
||||||
#endif
|
#endif
|
||||||
@ -444,7 +444,7 @@ query_complete(DWORD err, DWORD bytes, LPWSAOVERLAPPED overlapped)
|
|||||||
/*
|
/*
|
||||||
* getaddrinfo_thread() resolves a name and then exits.
|
* 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.
|
* and wait on it.
|
||||||
*/
|
*/
|
||||||
static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
|
static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
|
||||||
|
|||||||
@ -81,7 +81,7 @@
|
|||||||
#include "memdebug.h"
|
#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.
|
/* It makes support for IPv4-mapped IPv6 addresses.
|
||||||
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
||||||
* Windows Vista and later: default is on;
|
* Windows Vista and later: default is on;
|
||||||
@ -287,7 +287,7 @@ static CURLcode socket_open(struct Curl_easy *data,
|
|||||||
/* no socket, no connection */
|
/* no socket, no connection */
|
||||||
return CURLE_COULDNT_CONNECT;
|
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)) {
|
if(data->conn->scope_id && (addr->family == AF_INET6)) {
|
||||||
struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr;
|
struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr;
|
||||||
sa6->sin6_scope_id = data->conn->scope_id;
|
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 */
|
struct sockaddr *sock = (struct sockaddr *)&sa; /* bind to this address */
|
||||||
curl_socklen_t sizeof_sa = 0; /* size of the data sock points to */
|
curl_socklen_t sizeof_sa = 0; /* size of the data sock points to */
|
||||||
struct sockaddr_in *si4 = (struct sockaddr_in *)&sa;
|
struct sockaddr_in *si4 = (struct sockaddr_in *)&sa;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa;
|
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)&sa;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
#ifdef IP_BIND_ADDRESS_NO_PORT
|
#ifdef IP_BIND_ADDRESS_NO_PORT
|
||||||
int on = 1;
|
int on = 1;
|
||||||
#endif
|
#endif
|
||||||
#ifndef ENABLE_IPV6
|
#ifndef USE_IPV6
|
||||||
(void)scope;
|
(void)scope;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(Curl_if2ip(af,
|
switch(Curl_if2ip(af,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
scope, conn->scope_id,
|
scope, conn->scope_id,
|
||||||
#endif
|
#endif
|
||||||
dev, myhost, sizeof(myhost))) {
|
dev, myhost, sizeof(myhost))) {
|
||||||
@ -514,7 +514,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
|
|
||||||
if(af == AF_INET)
|
if(af == AF_INET)
|
||||||
conn->ip_version = CURL_IPRESOLVE_V4;
|
conn->ip_version = CURL_IPRESOLVE_V4;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(af == AF_INET6)
|
else if(af == AF_INET6)
|
||||||
conn->ip_version = CURL_IPRESOLVE_V6;
|
conn->ip_version = CURL_IPRESOLVE_V6;
|
||||||
#endif
|
#endif
|
||||||
@ -547,7 +547,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(done > 0) {
|
if(done > 0) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
/* IPv6 address */
|
/* IPv6 address */
|
||||||
if(af == AF_INET6) {
|
if(af == AF_INET6) {
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||||
@ -596,7 +596,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* no device was given, prepare sa to match af's needs */
|
/* no device was given, prepare sa to match af's needs */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(af == AF_INET6) {
|
if(af == AF_INET6) {
|
||||||
si6->sin6_family = AF_INET6;
|
si6->sin6_family = AF_INET6;
|
||||||
si6->sin6_port = htons(port);
|
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 */
|
/* We reuse/clobber the port variable here below */
|
||||||
if(sock->sa_family == AF_INET)
|
if(sock->sa_family == AF_INET)
|
||||||
si4->sin_port = ntohs(port);
|
si4->sin_port = ntohs(port);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
si6->sin6_port = ntohs(port);
|
si6->sin6_port = ntohs(port);
|
||||||
#endif
|
#endif
|
||||||
@ -991,7 +991,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||||||
if(result)
|
if(result)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(ctx->addr.family == AF_INET6) {
|
if(ctx->addr.family == AF_INET6) {
|
||||||
set_ipv6_v6only(ctx->sock, 0);
|
set_ipv6_v6only(ctx->sock, 0);
|
||||||
infof(data, " Trying [%s]:%d...", ctx->ip.remote_ip, ctx->ip.remote_port);
|
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
|
#endif
|
||||||
infof(data, " Trying %s:%d...", ctx->ip.remote_ip, ctx->ip.remote_port);
|
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
|
is_tcp = (ctx->addr.family == AF_INET
|
||||||
|| ctx->addr.family == AF_INET6) &&
|
|| ctx->addr.family == AF_INET6) &&
|
||||||
ctx->addr.socktype == SOCK_STREAM;
|
ctx->addr.socktype == SOCK_STREAM;
|
||||||
@ -1037,7 +1037,7 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||||||
#ifndef CURL_DISABLE_BINDLOCAL
|
#ifndef CURL_DISABLE_BINDLOCAL
|
||||||
/* possibly bind the local end to an IP, interface or port */
|
/* possibly bind the local end to an IP, interface or port */
|
||||||
if(ctx->addr.family == AF_INET
|
if(ctx->addr.family == AF_INET
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
|| ctx->addr.family == AF_INET6
|
|| ctx->addr.family == AF_INET6
|
||||||
#endif
|
#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 */
|
/* the first socket info gets some specials */
|
||||||
if(cf->sockindex == FIRSTSOCKET) {
|
if(cf->sockindex == FIRSTSOCKET) {
|
||||||
cf->conn->remote_addr = &ctx->addr;
|
cf->conn->remote_addr = &ctx->addr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
|
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
|
||||||
#endif
|
#endif
|
||||||
Curl_persistconninfo(data, cf->conn, &ctx->ip);
|
Curl_persistconninfo(data, cf->conn, &ctx->ip);
|
||||||
|
|||||||
@ -57,7 +57,7 @@
|
|||||||
#undef NEED_REENTRANT
|
#undef NEED_REENTRANT
|
||||||
|
|
||||||
/* Define if you want to enable IPv6 support */
|
/* 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 if struct sockaddr_in6 has the sin6_scope_id member */
|
||||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
#define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem"
|
#define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem"
|
||||||
#define CURL_CA_PATH "/sys/lib/tls"
|
#define CURL_CA_PATH "/sys/lib/tls"
|
||||||
#define CURL_STATICLIB 1
|
#define CURL_STATICLIB 1
|
||||||
#define ENABLE_IPV6 1
|
#define USE_IPV6 1
|
||||||
#define CURL_DISABLE_LDAP 1
|
#define CURL_DISABLE_LDAP 1
|
||||||
|
|
||||||
#define NEED_REENTRANT 1
|
#define NEED_REENTRANT 1
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
#undef NEED_REENTRANT
|
#undef NEED_REENTRANT
|
||||||
|
|
||||||
/* Define if you want to enable IPv6 support */
|
/* 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 if struct sockaddr_in6 has the sin6_scope_id member */
|
||||||
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
|
||||||
@ -66,9 +66,6 @@
|
|||||||
/* Define this as a suitable file to read random data from */
|
/* Define this as a suitable file to read random data from */
|
||||||
#undef RANDOM_FILE
|
#undef RANDOM_FILE
|
||||||
|
|
||||||
/* Define if you want to enable IPv6 support */
|
|
||||||
#undef ENABLE_IPV6
|
|
||||||
|
|
||||||
/* Define if you have the alarm function. */
|
/* Define if you have the alarm function. */
|
||||||
#define HAVE_ALARM
|
#define HAVE_ALARM
|
||||||
|
|
||||||
|
|||||||
@ -509,8 +509,4 @@ Vista
|
|||||||
/* If you want to build curl with the built-in manual */
|
/* If you want to build curl with the built-in manual */
|
||||||
#define USE_MANUAL 1
|
#define USE_MANUAL 1
|
||||||
|
|
||||||
#if defined(USE_IPV6)
|
|
||||||
# define ENABLE_IPV6 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* HEADER_CURL_CONFIG_WIN32_H */
|
#endif /* HEADER_CURL_CONFIG_WIN32_H */
|
||||||
|
|||||||
@ -140,7 +140,7 @@ static void hashkey(struct connectdata *conn, char *buf, size_t len)
|
|||||||
hostname = conn->host.name;
|
hostname = conn->host.name;
|
||||||
|
|
||||||
/* put the numbers first so that the hostname gets cut off if too long */
|
/* 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);
|
msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
|
||||||
#else
|
#else
|
||||||
msnprintf(buf, len, "%ld/%s", port, hostname);
|
msnprintf(buf, len, "%ld/%s", port, hostname);
|
||||||
|
|||||||
@ -195,7 +195,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
|
|||||||
char *addr, int *port)
|
char *addr, int *port)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *si = NULL;
|
struct sockaddr_in *si = NULL;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 *si6 = NULL;
|
struct sockaddr_in6 *si6 = NULL;
|
||||||
#endif
|
#endif
|
||||||
#if (defined(HAVE_SYS_UN_H) || defined(WIN32_SOCKADDR_UN)) && defined(AF_UNIX)
|
#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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
si6 = (struct sockaddr_in6 *)(void *) sa;
|
si6 = (struct sockaddr_in6 *)(void *) sa;
|
||||||
if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr,
|
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;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
baller->name = ((ai_family == AF_INET)? "ipv4" : (
|
baller->name = ((ai_family == AF_INET)? "ipv4" : (
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
(ai_family == AF_INET6)? "ipv6" :
|
(ai_family == AF_INET6)? "ipv6" :
|
||||||
#endif
|
#endif
|
||||||
"ip"));
|
"ip"));
|
||||||
@ -779,7 +779,7 @@ static CURLcode start_connect(struct Curl_cfilter *cf,
|
|||||||
/* any IP version is allowed */
|
/* any IP version is allowed */
|
||||||
ai_family0 = remotehost->addr?
|
ai_family0 = remotehost->addr?
|
||||||
remotehost->addr->ai_family : 0;
|
remotehost->addr->ai_family : 0;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ai_family1 = ai_family0 == AF_INET6 ?
|
ai_family1 = ai_family0 == AF_INET6 ?
|
||||||
AF_INET : AF_INET6;
|
AF_INET : AF_INET6;
|
||||||
#else
|
#else
|
||||||
@ -790,7 +790,7 @@ static CURLcode start_connect(struct Curl_cfilter *cf,
|
|||||||
/* only one IP version is allowed */
|
/* only one IP version is allowed */
|
||||||
ai_family0 = (conn->ip_version == CURL_IPRESOLVE_V4) ?
|
ai_family0 = (conn->ip_version == CURL_IPRESOLVE_V4) ?
|
||||||
AF_INET :
|
AF_INET :
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
AF_INET6;
|
AF_INET6;
|
||||||
#else
|
#else
|
||||||
AF_UNSPEC;
|
AF_UNSPEC;
|
||||||
|
|||||||
@ -130,7 +130,7 @@ Curl_getaddrinfo_ex(const char *nodename,
|
|||||||
/* settle family-specific sockaddr structure size. */
|
/* settle family-specific sockaddr structure size. */
|
||||||
if(ai->ai_family == AF_INET)
|
if(ai->ai_family == AF_INET)
|
||||||
ss_size = sizeof(struct sockaddr_in);
|
ss_size = sizeof(struct sockaddr_in);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(ai->ai_family == AF_INET6)
|
else if(ai->ai_family == AF_INET6)
|
||||||
ss_size = sizeof(struct sockaddr_in6);
|
ss_size = sizeof(struct sockaddr_in6);
|
||||||
#endif
|
#endif
|
||||||
@ -259,7 +259,7 @@ Curl_he2ai(const struct hostent *he, int port)
|
|||||||
struct Curl_addrinfo *prevai = NULL;
|
struct Curl_addrinfo *prevai = NULL;
|
||||||
struct Curl_addrinfo *firstai = NULL;
|
struct Curl_addrinfo *firstai = NULL;
|
||||||
struct sockaddr_in *addr;
|
struct sockaddr_in *addr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 *addr6;
|
struct sockaddr_in6 *addr6;
|
||||||
#endif
|
#endif
|
||||||
CURLcode result = CURLE_OK;
|
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++) {
|
for(i = 0; (curr = he->h_addr_list[i]) != NULL; i++) {
|
||||||
size_t ss_size;
|
size_t ss_size;
|
||||||
size_t namelen = strlen(he->h_name) + 1; /* include null-terminator */
|
size_t namelen = strlen(he->h_name) + 1; /* include null-terminator */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(he->h_addrtype == AF_INET6)
|
if(he->h_addrtype == AF_INET6)
|
||||||
ss_size = sizeof(struct sockaddr_in6);
|
ss_size = sizeof(struct sockaddr_in6);
|
||||||
else
|
else
|
||||||
@ -321,7 +321,7 @@ Curl_he2ai(const struct hostent *he, int port)
|
|||||||
addr->sin_port = htons((unsigned short)port);
|
addr->sin_port = htons((unsigned short)port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addr6 = (void *)ai->ai_addr; /* storage area for this info */
|
addr6 = (void *)ai->ai_addr; /* storage area for this info */
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ struct namebuff {
|
|||||||
struct hostent hostentry;
|
struct hostent hostentry;
|
||||||
union {
|
union {
|
||||||
struct in_addr ina4;
|
struct in_addr ina4;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct in6_addr ina6;
|
struct in6_addr ina6;
|
||||||
#endif
|
#endif
|
||||||
} addrentry;
|
} addrentry;
|
||||||
@ -401,7 +401,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
|
|||||||
addrentry = (void *)&buf->addrentry.ina4;
|
addrentry = (void *)&buf->addrentry.ina4;
|
||||||
memcpy(addrentry, inaddr, sizeof(struct in_addr));
|
memcpy(addrentry, inaddr, sizeof(struct in_addr));
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addrsize = sizeof(struct in6_addr);
|
addrsize = sizeof(struct in6_addr);
|
||||||
addrentry = (void *)&buf->addrentry.ina6;
|
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)
|
if(Curl_inet_pton(AF_INET, address, &in) > 0)
|
||||||
/* This is a dotted IP address 123.123.123.123-style */
|
/* This is a dotted IP address 123.123.123.123-style */
|
||||||
return Curl_ip2addr(AF_INET, &in, address, port);
|
return Curl_ip2addr(AF_INET, &in, address, port);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
{
|
{
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
if(Curl_inet_pton(AF_INET6, address, &in6) > 0)
|
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 Curl_addrinfo *ca;
|
||||||
struct sockaddr_in *addr;
|
struct sockaddr_in *addr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 *addr6;
|
struct sockaddr_in6 *addr6;
|
||||||
#endif
|
#endif
|
||||||
for(ca = addrinfo; ca != NULL; ca = ca->ai_next) {
|
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);
|
addr->sin_port = htons((unsigned short)port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addr6 = (void *)ca->ai_addr; /* storage area for this info */
|
addr6 = (void *)ca->ai_addr; /* storage area for this info */
|
||||||
addr6->sin6_port = htons((unsigned short)port);
|
addr6->sin6_port = htons((unsigned short)port);
|
||||||
|
|||||||
@ -163,7 +163,7 @@
|
|||||||
#cmakedefine USE_WIN32_LDAP 1
|
#cmakedefine USE_WIN32_LDAP 1
|
||||||
|
|
||||||
/* Define if you want to enable IPv6 support */
|
/* 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. */
|
/* Define to 1 if you have the alarm function. */
|
||||||
#cmakedefine HAVE_ALARM 1
|
#cmakedefine HAVE_ALARM 1
|
||||||
|
|||||||
@ -72,6 +72,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Compatibility */
|
||||||
|
#if defined(ENABLE_IPV6)
|
||||||
|
# define USE_IPV6 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Include configuration script results or hand-crafted
|
* Include configuration script results or hand-crafted
|
||||||
* configuration file for platforms which lack config tool.
|
* configuration file for platforms which lack config tool.
|
||||||
@ -309,7 +314,7 @@
|
|||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
#define USE_RESOLVE_ON_IPS 1
|
#define USE_RESOLVE_ON_IPS 1
|
||||||
# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \
|
# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \
|
||||||
defined(ENABLE_IPV6)
|
defined(USE_IPV6)
|
||||||
# define CURL_MACOS_CALL_COPYPROXIES 1
|
# define CURL_MACOS_CALL_COPYPROXIES 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@ -620,9 +625,9 @@
|
|||||||
* Mutually exclusive CURLRES_* definitions.
|
* Mutually exclusive CURLRES_* definitions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
|
#if defined(USE_IPV6) && defined(HAVE_GETADDRINFO)
|
||||||
# define CURLRES_IPV6
|
# 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 */
|
/* assume on Windows that IPv6 without getaddrinfo is a broken build */
|
||||||
# error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
|
# error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -408,7 +408,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
|
|||||||
goto error;
|
goto error;
|
||||||
dohp->pending++;
|
dohp->pending++;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if((conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
|
if((conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
|
||||||
/* create IPv6 DoH request */
|
/* create IPv6 DoH request */
|
||||||
result = dohprobe(data, &dohp->probe[DOH_PROBE_SLOT_IPADDR_V6],
|
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 *prevai = NULL;
|
||||||
struct Curl_addrinfo *firstai = NULL;
|
struct Curl_addrinfo *firstai = NULL;
|
||||||
struct sockaddr_in *addr;
|
struct sockaddr_in *addr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 *addr6;
|
struct sockaddr_in6 *addr6;
|
||||||
#endif
|
#endif
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
@ -820,7 +820,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname,
|
|||||||
size_t ss_size;
|
size_t ss_size;
|
||||||
CURL_SA_FAMILY_T addrtype;
|
CURL_SA_FAMILY_T addrtype;
|
||||||
if(de->addr[i].type == DNS_TYPE_AAAA) {
|
if(de->addr[i].type == DNS_TYPE_AAAA) {
|
||||||
#ifndef ENABLE_IPV6
|
#ifndef USE_IPV6
|
||||||
/* we can't handle IPv6 addresses */
|
/* we can't handle IPv6 addresses */
|
||||||
continue;
|
continue;
|
||||||
#else
|
#else
|
||||||
@ -869,7 +869,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname,
|
|||||||
addr->sin_port = htons((unsigned short)port);
|
addr->sin_port = htons((unsigned short)port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addr6 = (void *)ai->ai_addr; /* storage area for this info */
|
addr6 = (void *)ai->ai_addr; /* storage area for this info */
|
||||||
DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6));
|
DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6));
|
||||||
|
|||||||
18
lib/ftp.c
18
lib/ftp.c
@ -362,7 +362,7 @@ static CURLcode AcceptServerConnect(struct Curl_easy *data)
|
|||||||
struct connectdata *conn = data->conn;
|
struct connectdata *conn = data->conn;
|
||||||
curl_socket_t sock = conn->sock[SECONDARYSOCKET];
|
curl_socket_t sock = conn->sock[SECONDARYSOCKET];
|
||||||
curl_socket_t s = CURL_SOCKET_BAD;
|
curl_socket_t s = CURL_SOCKET_BAD;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct Curl_sockaddr_storage add;
|
struct Curl_sockaddr_storage add;
|
||||||
#else
|
#else
|
||||||
struct sockaddr_in add;
|
struct sockaddr_in add;
|
||||||
@ -1029,7 +1029,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
char hbuf[NI_MAXHOST];
|
char hbuf[NI_MAXHOST];
|
||||||
struct sockaddr *sa = (struct sockaddr *)&ss;
|
struct sockaddr *sa = (struct sockaddr *)&ss;
|
||||||
struct sockaddr_in * const sa4 = (void *)sa;
|
struct sockaddr_in * const sa4 = (void *)sa;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 * const sa6 = (void *)sa;
|
struct sockaddr_in6 * const sa6 = (void *)sa;
|
||||||
#endif
|
#endif
|
||||||
static const char mode[][5] = { "EPRT", "PORT" };
|
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)) {
|
(strlen(data->set.str[STRING_FTPPORT]) > 1)) {
|
||||||
char *ip_end = NULL;
|
char *ip_end = NULL;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(*string_ftpport == '[') {
|
if(*string_ftpport == '[') {
|
||||||
/* [ipv6]:port(-range) */
|
/* [ipv6]:port(-range) */
|
||||||
char *ip_start = string_ftpport + 1;
|
char *ip_start = string_ftpport + 1;
|
||||||
@ -1078,7 +1078,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
if(ip_end) {
|
if(ip_end) {
|
||||||
/* either ipv6 or (ipv4|domain|interface):port(-range) */
|
/* either ipv6 or (ipv4|domain|interface):port(-range) */
|
||||||
addrlen = ip_end - string_ftpport;
|
addrlen = ip_end - string_ftpport;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(Curl_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) {
|
if(Curl_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) {
|
||||||
/* ipv6 */
|
/* ipv6 */
|
||||||
port_min = port_max = 0;
|
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 */
|
/* attempt to get the address of the given interface name */
|
||||||
switch(Curl_if2ip(conn->remote_addr->family,
|
switch(Curl_if2ip(conn->remote_addr->family,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
Curl_ipv6_scope(&conn->remote_addr->sa_addr),
|
Curl_ipv6_scope(&conn->remote_addr->sa_addr),
|
||||||
conn->scope_id,
|
conn->scope_id,
|
||||||
#endif
|
#endif
|
||||||
@ -1156,7 +1156,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
switch(sa->sa_family) {
|
switch(sa->sa_family) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
|
r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
|
||||||
break;
|
break;
|
||||||
@ -1216,7 +1216,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
for(port = port_min; port <= port_max;) {
|
for(port = port_min; port <= port_max;) {
|
||||||
if(sa->sa_family == AF_INET)
|
if(sa->sa_family == AF_INET)
|
||||||
sa4->sin_port = htons(port);
|
sa4->sin_port = htons(port);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
sa6->sin6_port = htons(port);
|
sa6->sin6_port = htons(port);
|
||||||
#endif
|
#endif
|
||||||
@ -1284,7 +1284,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
below */
|
below */
|
||||||
Curl_printable_address(ai, myhost, sizeof(myhost));
|
Curl_printable_address(ai, myhost, sizeof(myhost));
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!conn->bits.ftp_use_eprt && conn->bits.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
|
/* EPRT is disabled but we are connected to a IPv6 host, so we ignore the
|
||||||
request and enable EPRT again! */
|
request and enable EPRT again! */
|
||||||
@ -1311,7 +1311,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
port = ntohs(sa4->sin_port);
|
port = ntohs(sa4->sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
port = ntohs(sa6->sin6_port);
|
port = ntohs(sa6->sin6_port);
|
||||||
break;
|
break;
|
||||||
|
|||||||
22
lib/hostip.c
22
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);
|
(void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
|
const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
|
||||||
const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
|
const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
|
||||||
@ -523,7 +523,7 @@ Curl_cache_addr(struct Curl_easy *data,
|
|||||||
return dns;
|
return dns;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
/* return a static IPv6 ::1 for the name */
|
/* return a static IPv6 ::1 for the name */
|
||||||
static struct Curl_addrinfo *get_localhost6(int port, const char *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;
|
return ca6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
/*
|
/*
|
||||||
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
|
* 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;
|
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
|
* 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)
|
bool Curl_host_is_ipnum(const char *hostname)
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
#endif
|
#endif
|
||||||
if(Curl_inet_pton(AF_INET, hostname, &in) > 0
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
|| Curl_inet_pton(AF_INET6, hostname, &in6) > 0
|
|| Curl_inet_pton(AF_INET6, hostname, &in6) > 0
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@ -760,7 +760,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
|
|||||||
if(!addr)
|
if(!addr)
|
||||||
return CURLRESOLV_ERROR;
|
return CURLRESOLV_ERROR;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else {
|
else {
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
/* check if this is an IPv6 address string */
|
/* check if this is an IPv6 address string */
|
||||||
@ -771,7 +771,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
|
|||||||
return CURLRESOLV_ERROR;
|
return CURLRESOLV_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
|
|
||||||
#else /* if USE_RESOLVE_ON_IPS */
|
#else /* if USE_RESOLVE_ON_IPS */
|
||||||
#ifndef CURL_DISABLE_DOH
|
#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)
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
|
||||||
/* This is a dotted IP address 123.123.123.123-style */
|
/* This is a dotted IP address 123.123.123.123-style */
|
||||||
ipnum = TRUE;
|
ipnum = TRUE;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else {
|
else {
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
/* check if this is an IPv6 address string */
|
/* 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 */
|
/* This is an IPv6 address literal */
|
||||||
ipnum = TRUE;
|
ipnum = TRUE;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
#endif /* CURL_DISABLE_DOH */
|
#endif /* CURL_DISABLE_DOH */
|
||||||
|
|
||||||
#endif /* !USE_RESOLVE_ON_IPS */
|
#endif /* !USE_RESOLVE_ON_IPS */
|
||||||
@ -1210,7 +1210,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
|
|||||||
memcpy(address, addr_begin, alen);
|
memcpy(address, addr_begin, alen);
|
||||||
address[alen] = '\0';
|
address[alen] = '\0';
|
||||||
|
|
||||||
#ifndef ENABLE_IPV6
|
#ifndef USE_IPV6
|
||||||
if(strchr(address, ':')) {
|
if(strchr(address, ':')) {
|
||||||
infof(data, "Ignoring resolve address '%s', missing IPv6 support.",
|
infof(data, "Ignoring resolve address '%s', missing IPv6 support.",
|
||||||
address);
|
address);
|
||||||
|
|||||||
@ -96,7 +96,7 @@ enum resolve_t Curl_resolv_timeout(struct Curl_easy *data,
|
|||||||
struct Curl_dns_entry **dnsentry,
|
struct Curl_dns_entry **dnsentry,
|
||||||
timediff_t timeoutms);
|
timediff_t timeoutms);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
/*
|
/*
|
||||||
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
|
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
|
||||||
*/
|
*/
|
||||||
|
|||||||
16
lib/if2ip.c
16
lib/if2ip.c
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
/* Return the scope of the given address. */
|
/* Return the scope of the given address. */
|
||||||
unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
|
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)
|
#if defined(HAVE_GETIFADDRS)
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af,
|
if2ip_result_t Curl_if2ip(int af,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int remote_scope,
|
unsigned int remote_scope,
|
||||||
unsigned int local_scope_id,
|
unsigned int local_scope_id,
|
||||||
#endif
|
#endif
|
||||||
@ -107,7 +107,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
struct ifaddrs *iface, *head;
|
struct ifaddrs *iface, *head;
|
||||||
if2ip_result_t res = IF2IP_NOT_FOUND;
|
if2ip_result_t res = IF2IP_NOT_FOUND;
|
||||||
|
|
||||||
#if defined(ENABLE_IPV6) && \
|
#if defined(USE_IPV6) && \
|
||||||
!defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
!defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
||||||
(void) local_scope_id;
|
(void) local_scope_id;
|
||||||
#endif
|
#endif
|
||||||
@ -121,7 +121,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
const char *ip;
|
const char *ip;
|
||||||
char scope[12] = "";
|
char scope[12] = "";
|
||||||
char ipstr[64];
|
char ipstr[64];
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(af == AF_INET6) {
|
if(af == AF_INET6) {
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
||||||
unsigned int scopeid = 0;
|
unsigned int scopeid = 0;
|
||||||
@ -182,7 +182,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
#elif defined(HAVE_IOCTL_SIOCGIFADDR)
|
#elif defined(HAVE_IOCTL_SIOCGIFADDR)
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af,
|
if2ip_result_t Curl_if2ip(int af,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int remote_scope,
|
unsigned int remote_scope,
|
||||||
unsigned int local_scope_id,
|
unsigned int local_scope_id,
|
||||||
#endif
|
#endif
|
||||||
@ -196,7 +196,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
size_t len;
|
size_t len;
|
||||||
const char *r;
|
const char *r;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
(void)remote_scope;
|
(void)remote_scope;
|
||||||
(void)local_scope_id;
|
(void)local_scope_id;
|
||||||
#endif
|
#endif
|
||||||
@ -237,7 +237,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af,
|
if2ip_result_t Curl_if2ip(int af,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int remote_scope,
|
unsigned int remote_scope,
|
||||||
unsigned int local_scope_id,
|
unsigned int local_scope_id,
|
||||||
#endif
|
#endif
|
||||||
@ -245,7 +245,7 @@ if2ip_result_t Curl_if2ip(int af,
|
|||||||
char *buf, int buf_size)
|
char *buf, int buf_size)
|
||||||
{
|
{
|
||||||
(void) af;
|
(void) af;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
(void) remote_scope;
|
(void) remote_scope;
|
||||||
(void) local_scope_id;
|
(void) local_scope_id;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#define IPV6_SCOPE_UNIQUELOCAL 3 /* Unique local */
|
#define IPV6_SCOPE_UNIQUELOCAL 3 /* Unique local */
|
||||||
#define IPV6_SCOPE_NODELOCAL 4 /* Loopback. */
|
#define IPV6_SCOPE_NODELOCAL 4 /* Loopback. */
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
|
unsigned int Curl_ipv6_scope(const struct sockaddr *sa);
|
||||||
#else
|
#else
|
||||||
#define Curl_ipv6_scope(x) 0
|
#define Curl_ipv6_scope(x) 0
|
||||||
@ -45,7 +45,7 @@ typedef enum {
|
|||||||
} if2ip_result_t;
|
} if2ip_result_t;
|
||||||
|
|
||||||
if2ip_result_t Curl_if2ip(int af,
|
if2ip_result_t Curl_if2ip(int af,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int remote_scope,
|
unsigned int remote_scope,
|
||||||
unsigned int local_scope_id,
|
unsigned int local_scope_id,
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -42,11 +42,11 @@
|
|||||||
#define INT16SZ 2
|
#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
|
* sure we have _some_ value for AF_INET6 without polluting our fake value
|
||||||
* everywhere.
|
* everywhere.
|
||||||
*/
|
*/
|
||||||
#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
|
#if !defined(USE_IPV6) && !defined(AF_INET6)
|
||||||
#define AF_INET6 (AF_INET + 1)
|
#define AF_INET6 (AF_INET + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -39,11 +39,11 @@
|
|||||||
#define INT16SZ 2
|
#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
|
* sure we have _some_ value for AF_INET6 without polluting our fake value
|
||||||
* everywhere.
|
* everywhere.
|
||||||
*/
|
*/
|
||||||
#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
|
#if !defined(USE_IPV6) && !defined(AF_INET6)
|
||||||
#define AF_INET6 (AF_INET + 1)
|
#define AF_INET6 (AF_INET + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6,
|
|||||||
const char *network,
|
const char *network,
|
||||||
unsigned int bits)
|
unsigned int bits)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
int bytes;
|
int bytes;
|
||||||
int rest;
|
int rest;
|
||||||
unsigned char address[16];
|
unsigned char address[16];
|
||||||
|
|||||||
@ -2634,7 +2634,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case CURLOPT_ADDRESS_SCOPE:
|
case CURLOPT_ADDRESS_SCOPE:
|
||||||
/*
|
/*
|
||||||
* Use this scope id when using IPv6
|
* Use this scope id when using IPv6
|
||||||
|
|||||||
@ -374,8 +374,8 @@ static struct passwd *vms_getpwuid(uid_t uid)
|
|||||||
#ifdef HAVE_NETDB_H
|
#ifdef HAVE_NETDB_H
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#ifndef AI_NUMERICHOST
|
#ifndef AI_NUMERICHOST
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
#undef ENABLE_IPV6
|
#undef USE_IPV6
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -30,7 +30,7 @@ struct Curl_sockaddr_storage {
|
|||||||
union {
|
union {
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
struct sockaddr_in sa_in;
|
struct sockaddr_in sa_in;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 sa_in6;
|
struct sockaddr_in6 sa_in6;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
|
#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
|
||||||
|
|||||||
@ -838,7 +838,7 @@ CONNECT_RESOLVED:
|
|||||||
struct Curl_addrinfo *hp = NULL;
|
struct Curl_addrinfo *hp = NULL;
|
||||||
if(dns)
|
if(dns)
|
||||||
hp = dns->addr;
|
hp = dns->addr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(data->set.ipver != CURL_IPRESOLVE_WHATEVER) {
|
if(data->set.ipver != CURL_IPRESOLVE_WHATEVER) {
|
||||||
int wanted_family = data->set.ipver == CURL_IPRESOLVE_V4 ?
|
int wanted_family = data->set.ipver == CURL_IPRESOLVE_V4 ?
|
||||||
AF_INET : AF_INET6;
|
AF_INET : AF_INET6;
|
||||||
@ -872,7 +872,7 @@ CONNECT_RESOLVED:
|
|||||||
infof(data, "SOCKS5 connect to %s:%d (locally resolved)", dest,
|
infof(data, "SOCKS5 connect to %s:%d (locally resolved)", dest,
|
||||||
sx->remote_port);
|
sx->remote_port);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(hp->ai_family == AF_INET6) {
|
else if(hp->ai_family == AF_INET6) {
|
||||||
int i;
|
int i;
|
||||||
struct sockaddr_in6 *saddr_in6;
|
struct sockaddr_in6 *saddr_in6;
|
||||||
@ -909,7 +909,7 @@ CONNECT_RESOLVE_REMOTE:
|
|||||||
IPv6 == 4,
|
IPv6 == 4,
|
||||||
IPv4 == 1 */
|
IPv4 == 1 */
|
||||||
unsigned char ip4[4];
|
unsigned char ip4[4];
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(conn->bits.ipv6_ip) {
|
if(conn->bits.ipv6_ip) {
|
||||||
char ip6[16];
|
char ip6[16];
|
||||||
if(1 != Curl_inet_pton(AF_INET6, sx->hostname, ip6))
|
if(1 != Curl_inet_pton(AF_INET6, sx->hostname, ip6))
|
||||||
|
|||||||
@ -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
|
* If the URL was set with an IPv6 numerical address with a zone id part, set
|
||||||
* the scope_id based on that!
|
* 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);
|
(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(data->set.scope_id)
|
if(data->set.scope_id)
|
||||||
/* Override any scope that was set above. */
|
/* Override any scope that was set above. */
|
||||||
conn->scope_id = data->set.scope_id;
|
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 */
|
/* detect and extract RFC6874-style IPv6-addresses */
|
||||||
if(*hostptr == '[') {
|
if(*hostptr == '[') {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
char *ptr = ++hostptr; /* advance beyond the initial bracket */
|
char *ptr = ++hostptr; /* advance beyond the initial bracket */
|
||||||
while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '.')))
|
while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '.')))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|||||||
@ -59,11 +59,11 @@
|
|||||||
#define MAX_SCHEME_LEN 40
|
#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
|
* sure we have _some_ value for AF_INET6 without polluting our fake value
|
||||||
* everywhere.
|
* everywhere.
|
||||||
*/
|
*/
|
||||||
#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
|
#if !defined(USE_IPV6) && !defined(AF_INET6)
|
||||||
#define AF_INET6 (AF_INET + 1)
|
#define AF_INET6 (AF_INET + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -984,7 +984,7 @@ struct connectdata {
|
|||||||
int remote_port; /* the remote port, not the proxy port! */
|
int remote_port; /* the remote port, not the proxy port! */
|
||||||
int conn_to_port; /* the remote port to connect to. valid only if
|
int conn_to_port; /* the remote port to connect to. valid only if
|
||||||
bits.conn_to_port is set */
|
bits.conn_to_port is set */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int scope_id; /* Scope id for IPv6 */
|
unsigned int scope_id; /* Scope id for IPv6 */
|
||||||
#endif
|
#endif
|
||||||
unsigned short localport;
|
unsigned short localport;
|
||||||
@ -1706,7 +1706,7 @@ struct UserDefined {
|
|||||||
unsigned int new_file_perms; /* when creating remote files */
|
unsigned int new_file_perms; /* when creating remote files */
|
||||||
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
|
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
|
||||||
struct curl_blob *blobs[BLOB_LAST];
|
struct curl_blob *blobs[BLOB_LAST];
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
unsigned int scope_id; /* Scope id for IPv6 */
|
unsigned int scope_id; /* Scope id for IPv6 */
|
||||||
#endif
|
#endif
|
||||||
curl_prot_t allowed_protocols;
|
curl_prot_t allowed_protocols;
|
||||||
|
|||||||
@ -478,7 +478,7 @@ static const struct feat features_table[] = {
|
|||||||
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN)
|
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN)
|
||||||
FEATURE("IDN", idn_present, CURL_VERSION_IDN),
|
FEATURE("IDN", idn_present, CURL_VERSION_IDN),
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
FEATURE("IPv6", NULL, CURL_VERSION_IPV6),
|
FEATURE("IPv6", NULL, CURL_VERSION_IPV6),
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_KERBEROS5
|
#ifdef USE_KERBEROS5
|
||||||
|
|||||||
@ -182,7 +182,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr,
|
|||||||
result = CURLE_OK;
|
result = CURLE_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
struct sockaddr_in6 * const sin =
|
struct sockaddr_in6 * const sin =
|
||||||
(struct sockaddr_in6 * const)(void *)&addr->sa_addr;
|
(struct sockaddr_in6 * const)(void *)&addr->sa_addr;
|
||||||
@ -192,7 +192,7 @@ static CURLcode make_bio_addr(BIO_ADDR **pbio_addr,
|
|||||||
result = CURLE_OK;
|
result = CURLE_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
default:
|
default:
|
||||||
/* sunsupported */
|
/* sunsupported */
|
||||||
DEBUGASSERT(0);
|
DEBUGASSERT(0);
|
||||||
|
|||||||
@ -1204,7 +1204,7 @@ Curl_gtls_verifyserver(struct Curl_easy *data,
|
|||||||
/* Before 3.3.6, gnutls_x509_crt_check_hostname() didn't check IP
|
/* Before 3.3.6, gnutls_x509_crt_check_hostname() didn't check IP
|
||||||
addresses. */
|
addresses. */
|
||||||
if(!rc) {
|
if(!rc) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
#define use_addr in6_addr
|
#define use_addr in6_addr
|
||||||
#else
|
#else
|
||||||
#define use_addr in_addr
|
#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)
|
if(Curl_inet_pton(AF_INET, peer->hostname, addrbuf) > 0)
|
||||||
addrlen = 4;
|
addrlen = 4;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(Curl_inet_pton(AF_INET6, peer->hostname, addrbuf) > 0)
|
else if(Curl_inet_pton(AF_INET6, peer->hostname, addrbuf) > 0)
|
||||||
addrlen = 16;
|
addrlen = 16;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -2147,7 +2147,7 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
int target; /* target type, GEN_DNS or GEN_IPADD */
|
int target; /* target type, GEN_DNS or GEN_IPADD */
|
||||||
size_t addrlen = 0;
|
size_t addrlen = 0;
|
||||||
STACK_OF(GENERAL_NAME) *altnames;
|
STACK_OF(GENERAL_NAME) *altnames;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
#else
|
#else
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
@ -2166,7 +2166,7 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
target = GEN_IPADD;
|
target = GEN_IPADD;
|
||||||
addrlen = sizeof(struct in_addr);
|
addrlen = sizeof(struct in_addr);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case CURL_SSL_PEER_IPV6:
|
case CURL_SSL_PEER_IPV6:
|
||||||
if(!Curl_inet_pton(AF_INET6, peer->hostname, &addr))
|
if(!Curl_inet_pton(AF_INET6, peer->hostname, &addr))
|
||||||
return CURLE_PEER_FAILED_VERIFICATION;
|
return CURLE_PEER_FAILED_VERIFICATION;
|
||||||
|
|||||||
@ -357,12 +357,12 @@ static bool
|
|||||||
cr_hostname_is_ip(const char *hostname)
|
cr_hostname_is_ip(const char *hostname)
|
||||||
{
|
{
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) {
|
if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
|
if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
static ssl_peer_type get_peer_type(const char *hostname)
|
||||||
{
|
{
|
||||||
if(hostname && hostname[0]) {
|
if(hostname && hostname[0]) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
#else
|
#else
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
#endif
|
#endif
|
||||||
if(Curl_inet_pton(AF_INET, hostname, &addr))
|
if(Curl_inet_pton(AF_INET, hostname, &addr))
|
||||||
return CURL_SSL_PEER_IPV4;
|
return CURL_SSL_PEER_IPV4;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else if(Curl_inet_pton(AF_INET6, hostname, &addr)) {
|
else if(Curl_inet_pton(AF_INET6, hostname, &addr)) {
|
||||||
return CURL_SSL_PEER_IPV6;
|
return CURL_SSL_PEER_IPV6;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,7 +119,7 @@ static const char *configfile = DEFAULT_CONFIG;
|
|||||||
static const char *logdir = "log";
|
static const char *logdir = "log";
|
||||||
static char loglockfile[256];
|
static char loglockfile[256];
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
static const char *ipv_inuse = "IPv4";
|
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
|
/* When the specified listener port is zero, it is actually a
|
||||||
request to let the system choose a non-zero available port. */
|
request to let the system choose a non-zero available port. */
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
memset(&listener.sa4, 0, sizeof(listener.sa4));
|
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_addr.s_addr = INADDR_ANY;
|
||||||
listener.sa4.sin_port = htons(*listenport);
|
listener.sa4.sin_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&listener.sa6, 0, sizeof(listener.sa6));
|
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);
|
listener.sa6.sin6_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(rc) {
|
if(rc) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("Error binding socket on port %hu: (%d) %s",
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
la_size = sizeof(localaddr.sa4);
|
la_size = sizeof(localaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -889,7 +889,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
*listenport = ntohs(localaddr.sa4.sin_port);
|
*listenport = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
*listenport = ntohs(localaddr.sa6.sin6_port);
|
*listenport = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
@ -937,7 +937,7 @@ int main(int argc, char *argv[])
|
|||||||
while(argc>arg) {
|
while(argc>arg) {
|
||||||
if(!strcmp("--version", argv[arg])) {
|
if(!strcmp("--version", argv[arg])) {
|
||||||
printf("mqttd IPv4%s\n",
|
printf("mqttd IPv4%s\n",
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
@ -971,7 +971,7 @@ int main(int argc, char *argv[])
|
|||||||
logdir = argv[arg++];
|
logdir = argv[arg++];
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv6";
|
ipv_inuse = "IPv6";
|
||||||
use_ipv6 = TRUE;
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
@ -979,7 +979,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
/* for completeness, we support this option as well */
|
/* for completeness, we support this option as well */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv4";
|
ipv_inuse = "IPv4";
|
||||||
use_ipv6 = FALSE;
|
use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
@ -1029,11 +1029,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
install_signal_handlers(FALSE);
|
install_signal_handlers(FALSE);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
#define ERANGE 34 /* errno.h value */
|
#define ERANGE 34 /* errno.h value */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
static const char *ipv_inuse = "IPv4";
|
static const char *ipv_inuse = "IPv4";
|
||||||
@ -1074,7 +1074,7 @@ int main(int argc, char *argv[])
|
|||||||
printf("rtspd IPv4%s"
|
printf("rtspd IPv4%s"
|
||||||
"\n"
|
"\n"
|
||||||
,
|
,
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
@ -1103,14 +1103,14 @@ int main(int argc, char *argv[])
|
|||||||
logdir = argv[arg++];
|
logdir = argv[arg++];
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv4";
|
ipv_inuse = "IPv4";
|
||||||
use_ipv6 = FALSE;
|
use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv6";
|
ipv_inuse = "IPv6";
|
||||||
use_ipv6 = TRUE;
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
@ -1157,11 +1157,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
install_signal_handlers(false);
|
install_signal_handlers(false);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
#endif
|
#endif
|
||||||
@ -1181,7 +1181,7 @@ int main(int argc, char *argv[])
|
|||||||
goto server_cleanup;
|
goto server_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
memset(&me.sa4, 0, sizeof(me.sa4));
|
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_addr.s_addr = INADDR_ANY;
|
||||||
me.sa4.sin_port = htons(port);
|
me.sa4.sin_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&me.sa6, 0, sizeof(me.sa6));
|
memset(&me.sa6, 0, sizeof(me.sa6));
|
||||||
@ -1198,7 +1198,7 @@ int main(int argc, char *argv[])
|
|||||||
me.sa6.sin6_port = htons(port);
|
me.sa6.sin6_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(0 != rc) {
|
if(0 != rc) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("Error binding socket on port %hu: (%d) %s",
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
la_size = sizeof(localaddr.sa4);
|
la_size = sizeof(localaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -1231,7 +1231,7 @@ int main(int argc, char *argv[])
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
port = ntohs(localaddr.sa4.sin_port);
|
port = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
port = ntohs(localaddr.sa6.sin6_port);
|
port = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
typedef union {
|
typedef union {
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
struct sockaddr_in sa4;
|
struct sockaddr_in sa4;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_in6 sa6;
|
struct sockaddr_in6 sa6;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
|
|||||||
@ -138,7 +138,7 @@ const char *serverlogfile = DEFAULT_LOGFILE;
|
|||||||
|
|
||||||
static bool verbose = FALSE;
|
static bool verbose = FALSE;
|
||||||
static bool bind_only = FALSE;
|
static bool bind_only = FALSE;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
static const char *ipv_inuse = "IPv4";
|
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
|
/* When the specified listener port is zero, it is actually a
|
||||||
request to let the system choose a non-zero available port. */
|
request to let the system choose a non-zero available port. */
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
memset(&listener.sa4, 0, sizeof(listener.sa4));
|
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_addr.s_addr = INADDR_ANY;
|
||||||
listener.sa4.sin_port = htons(*listenport);
|
listener.sa4.sin_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&listener.sa6, 0, sizeof(listener.sa6));
|
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);
|
listener.sa6.sin6_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(rc) {
|
if(rc) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("Error binding socket on port %hu: (%d) %s",
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
la_size = sizeof(localaddr.sa4);
|
la_size = sizeof(localaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -1306,7 +1306,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
*listenport = ntohs(localaddr.sa4.sin_port);
|
*listenport = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
*listenport = ntohs(localaddr.sa6.sin6_port);
|
*listenport = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
@ -1364,7 +1364,7 @@ int main(int argc, char *argv[])
|
|||||||
while(argc>arg) {
|
while(argc>arg) {
|
||||||
if(!strcmp("--version", argv[arg])) {
|
if(!strcmp("--version", argv[arg])) {
|
||||||
printf("sockfilt IPv4%s\n",
|
printf("sockfilt IPv4%s\n",
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
@ -1392,7 +1392,7 @@ int main(int argc, char *argv[])
|
|||||||
serverlogfile = argv[arg++];
|
serverlogfile = argv[arg++];
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv6";
|
ipv_inuse = "IPv6";
|
||||||
use_ipv6 = TRUE;
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
@ -1400,7 +1400,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
/* for completeness, we support this option as well */
|
/* for completeness, we support this option as well */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv4";
|
ipv_inuse = "IPv4";
|
||||||
use_ipv6 = FALSE;
|
use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
@ -1472,11 +1472,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
install_signal_handlers(false);
|
install_signal_handlers(false);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
#endif
|
#endif
|
||||||
@ -1491,7 +1491,7 @@ int main(int argc, char *argv[])
|
|||||||
if(connectport) {
|
if(connectport) {
|
||||||
/* Active mode, we should connect to the given port number */
|
/* Active mode, we should connect to the given port number */
|
||||||
mode = ACTIVE;
|
mode = ACTIVE;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
memset(&me.sa4, 0, sizeof(me.sa4));
|
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);
|
Curl_inet_pton(AF_INET, addr, &me.sa4.sin_addr);
|
||||||
|
|
||||||
rc = connect(sock, &me.sa, sizeof(me.sa4));
|
rc = connect(sock, &me.sa, sizeof(me.sa4));
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&me.sa6, 0, sizeof(me.sa6));
|
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));
|
rc = connect(sock, &me.sa, sizeof(me.sa6));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(rc) {
|
if(rc) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("Error connecting to port %hu: (%d) %s",
|
logmsg("Error connecting to port %hu: (%d) %s",
|
||||||
|
|||||||
@ -176,7 +176,7 @@ static unsigned short shortval(char *value)
|
|||||||
|
|
||||||
static enum {
|
static enum {
|
||||||
socket_domain_inet = AF_INET
|
socket_domain_inet = AF_INET
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
, socket_domain_inet6 = AF_INET6
|
, socket_domain_inet6 = AF_INET6
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
@ -865,7 +865,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
|
|||||||
listener.sa4.sin_port = htons(*listenport);
|
listener.sa4.sin_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa4));
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
memset(&listener.sa6, 0, sizeof(listener.sa6));
|
memset(&listener.sa6, 0, sizeof(listener.sa6));
|
||||||
listener.sa6.sin6_family = AF_INET6;
|
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);
|
listener.sa6.sin6_port = htons(*listenport);
|
||||||
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
rc = bind(sock, &listener.sa, sizeof(listener.sa6));
|
||||||
break;
|
break;
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
rc = bind_unix_socket(sock, unix_socket, &listener.sau);
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(socket_domain == AF_INET6)
|
if(socket_domain == AF_INET6)
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
else
|
else
|
||||||
@ -921,7 +921,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
*listenport = ntohs(localaddr.sa4.sin_port);
|
*listenport = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
*listenport = ntohs(localaddr.sa6.sin6_port);
|
*listenport = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
@ -974,7 +974,7 @@ int main(int argc, char *argv[])
|
|||||||
while(argc>arg) {
|
while(argc>arg) {
|
||||||
if(!strcmp("--version", argv[arg])) {
|
if(!strcmp("--version", argv[arg])) {
|
||||||
printf("socksd IPv4%s\n",
|
printf("socksd IPv4%s\n",
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
@ -1018,7 +1018,7 @@ int main(int argc, char *argv[])
|
|||||||
reqlogfile = argv[arg++];
|
reqlogfile = argv[arg++];
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
socket_domain = AF_INET6;
|
socket_domain = AF_INET6;
|
||||||
socket_type = "IPv6";
|
socket_type = "IPv6";
|
||||||
#endif
|
#endif
|
||||||
@ -1026,7 +1026,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
/* for completeness, we support this option as well */
|
/* for completeness, we support this option as well */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
socket_type = "IPv4";
|
socket_type = "IPv4";
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
|
|||||||
@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
static enum {
|
static enum {
|
||||||
socket_domain_inet = AF_INET
|
socket_domain_inet = AF_INET
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
, socket_domain_inet6 = AF_INET6
|
, socket_domain_inet6 = AF_INET6
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
@ -229,7 +229,7 @@ static bool socket_domain_is_ip(void)
|
|||||||
{
|
{
|
||||||
switch(socket_domain) {
|
switch(socket_domain) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
@ -1290,7 +1290,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||||||
const char *op_br = "";
|
const char *op_br = "";
|
||||||
const char *cl_br = "";
|
const char *cl_br = "";
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(socket_domain == AF_INET6) {
|
if(socket_domain == AF_INET6) {
|
||||||
op_br = "[";
|
op_br = "[";
|
||||||
cl_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));
|
rc = connect(serverfd, &serveraddr.sa, sizeof(serveraddr.sa4));
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
memset(&serveraddr.sa6, 0, sizeof(serveraddr.sa6));
|
memset(&serveraddr.sa6, 0, sizeof(serveraddr.sa6));
|
||||||
serveraddr.sa6.sin6_family = AF_INET6;
|
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));
|
rc = connect(serverfd, &serveraddr.sa, sizeof(serveraddr.sa6));
|
||||||
break;
|
break;
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
logmsg("Proxying through Unix socket is not (yet?) supported.");
|
logmsg("Proxying through Unix socket is not (yet?) supported.");
|
||||||
@ -1976,7 +1976,7 @@ int main(int argc, char *argv[])
|
|||||||
while(argc>arg) {
|
while(argc>arg) {
|
||||||
if(!strcmp("--version", argv[arg])) {
|
if(!strcmp("--version", argv[arg])) {
|
||||||
puts("sws IPv4"
|
puts("sws IPv4"
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
@ -2023,7 +2023,7 @@ int main(int argc, char *argv[])
|
|||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
socket_type = "IPv6";
|
socket_type = "IPv6";
|
||||||
socket_domain = AF_INET6;
|
socket_domain = AF_INET6;
|
||||||
location_str = port_str;
|
location_str = port_str;
|
||||||
@ -2164,7 +2164,7 @@ int main(int argc, char *argv[])
|
|||||||
me.sa4.sin_port = htons(port);
|
me.sa4.sin_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
memset(&me.sa6, 0, sizeof(me.sa6));
|
memset(&me.sa6, 0, sizeof(me.sa6));
|
||||||
me.sa6.sin6_family = AF_INET6;
|
me.sa6.sin6_family = AF_INET6;
|
||||||
@ -2172,7 +2172,7 @@ int main(int argc, char *argv[])
|
|||||||
me.sa6.sin6_port = htons(port);
|
me.sa6.sin6_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
||||||
break;
|
break;
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
rc = bind_unix_socket(sock, unix_socket, &me.sau);
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(socket_domain != AF_INET6)
|
if(socket_domain != AF_INET6)
|
||||||
#endif
|
#endif
|
||||||
la_size = sizeof(localaddr.sa4);
|
la_size = sizeof(localaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -2216,7 +2216,7 @@ int main(int argc, char *argv[])
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
port = ntohs(localaddr.sa4.sin_port);
|
port = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
port = ntohs(localaddr.sa6.sin6_port);
|
port = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -201,7 +201,7 @@ static curl_socket_t peer = CURL_SOCKET_BAD;
|
|||||||
static unsigned int timeout;
|
static unsigned int timeout;
|
||||||
static unsigned int maxtimeout = 5 * TIMEOUT;
|
static unsigned int maxtimeout = 5 * TIMEOUT;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
static bool use_ipv6 = FALSE;
|
static bool use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
static const char *ipv_inuse = "IPv4";
|
static const char *ipv_inuse = "IPv4";
|
||||||
@ -530,11 +530,11 @@ static int synchnet(curl_socket_t f /* socket to flush */)
|
|||||||
#endif
|
#endif
|
||||||
if(i) {
|
if(i) {
|
||||||
j++;
|
j++;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
fromaddrlen = sizeof(fromaddr.sa4);
|
fromaddrlen = sizeof(fromaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
fromaddrlen = sizeof(fromaddr.sa6);
|
fromaddrlen = sizeof(fromaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -566,7 +566,7 @@ int main(int argc, char **argv)
|
|||||||
while(argc>arg) {
|
while(argc>arg) {
|
||||||
if(!strcmp("--version", argv[arg])) {
|
if(!strcmp("--version", argv[arg])) {
|
||||||
printf("tftpd IPv4%s\n",
|
printf("tftpd IPv4%s\n",
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
"/IPv6"
|
"/IPv6"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
@ -595,14 +595,14 @@ int main(int argc, char **argv)
|
|||||||
logdir = argv[arg++];
|
logdir = argv[arg++];
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv4", argv[arg])) {
|
else if(!strcmp("--ipv4", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv4";
|
ipv_inuse = "IPv4";
|
||||||
use_ipv6 = FALSE;
|
use_ipv6 = FALSE;
|
||||||
#endif
|
#endif
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
else if(!strcmp("--ipv6", argv[arg])) {
|
else if(!strcmp("--ipv6", argv[arg])) {
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
ipv_inuse = "IPv6";
|
ipv_inuse = "IPv6";
|
||||||
use_ipv6 = TRUE;
|
use_ipv6 = TRUE;
|
||||||
#endif
|
#endif
|
||||||
@ -649,11 +649,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
install_signal_handlers(true);
|
install_signal_handlers(true);
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
sock = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||||
#endif
|
#endif
|
||||||
@ -675,7 +675,7 @@ int main(int argc, char **argv)
|
|||||||
goto tftpd_cleanup;
|
goto tftpd_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
memset(&me.sa4, 0, sizeof(me.sa4));
|
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_addr.s_addr = INADDR_ANY;
|
||||||
me.sa4.sin_port = htons(port);
|
me.sa4.sin_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
rc = bind(sock, &me.sa, sizeof(me.sa4));
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memset(&me.sa6, 0, sizeof(me.sa6));
|
memset(&me.sa6, 0, sizeof(me.sa6));
|
||||||
@ -692,7 +692,7 @@ int main(int argc, char **argv)
|
|||||||
me.sa6.sin6_port = htons(port);
|
me.sa6.sin6_port = htons(port);
|
||||||
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
rc = bind(sock, &me.sa, sizeof(me.sa6));
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_IPV6 */
|
#endif /* USE_IPV6 */
|
||||||
if(0 != rc) {
|
if(0 != rc) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("Error binding socket on port %hu: (%d) %s", port, error,
|
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. */
|
port we actually got and update the listener port value with it. */
|
||||||
curl_socklen_t la_size;
|
curl_socklen_t la_size;
|
||||||
srvr_sockaddr_union_t localaddr;
|
srvr_sockaddr_union_t localaddr;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
la_size = sizeof(localaddr.sa4);
|
la_size = sizeof(localaddr.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
la_size = sizeof(localaddr.sa6);
|
la_size = sizeof(localaddr.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -726,7 +726,7 @@ int main(int argc, char **argv)
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
port = ntohs(localaddr.sa4.sin_port);
|
port = ntohs(localaddr.sa4.sin_port);
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
port = ntohs(localaddr.sa6.sin6_port);
|
port = ntohs(localaddr.sa6.sin6_port);
|
||||||
break;
|
break;
|
||||||
@ -763,11 +763,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
fromlen = sizeof(from);
|
fromlen = sizeof(from);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6)
|
if(!use_ipv6)
|
||||||
#endif
|
#endif
|
||||||
fromlen = sizeof(from.sa4);
|
fromlen = sizeof(from.sa4);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
else
|
else
|
||||||
fromlen = sizeof(from.sa6);
|
fromlen = sizeof(from.sa6);
|
||||||
#endif
|
#endif
|
||||||
@ -784,7 +784,7 @@ int main(int argc, char **argv)
|
|||||||
set_advisor_read_lock(loglockfile);
|
set_advisor_read_lock(loglockfile);
|
||||||
serverlogslocked = 1;
|
serverlogslocked = 1;
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(!use_ipv6) {
|
if(!use_ipv6) {
|
||||||
#endif
|
#endif
|
||||||
from.sa4.sin_family = AF_INET;
|
from.sa4.sin_family = AF_INET;
|
||||||
@ -799,7 +799,7 @@ int main(int argc, char **argv)
|
|||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
from.sa6.sin6_family = AF_INET6;
|
from.sa6.sin6_family = AF_INET6;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ struct testcase {
|
|||||||
/* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
|
/* In builds without IPv6 support CURLOPT_RESOLVE should skip over those
|
||||||
addresses, so we have to do that as well. */
|
addresses, so we have to do that as well. */
|
||||||
static const char skip = 0;
|
static const char skip = 0;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
#define IPV6ONLY(x) x
|
#define IPV6ONLY(x) x
|
||||||
#else
|
#else
|
||||||
#define IPV6ONLY(x) &skip
|
#define IPV6ONLY(x) &skip
|
||||||
|
|||||||
@ -193,7 +193,7 @@ static CURLcode cf_test_create(struct Curl_cfilter **pcf,
|
|||||||
ctx->ai_family = ai->ai_family;
|
ctx->ai_family = ai->ai_family;
|
||||||
ctx->transport = transport;
|
ctx->transport = transport;
|
||||||
ctx->started = Curl_now();
|
ctx->started = Curl_now();
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
if(ctx->ai_family == AF_INET6) {
|
if(ctx->ai_family == AF_INET6) {
|
||||||
ctx->stats = ¤t_tr->cf6;
|
ctx->stats = ¤t_tr->cf6;
|
||||||
ctx->fail_delay_ms = current_tc->cf6_fail_delay_ms;
|
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,
|
{ 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 },
|
CNCT_TMOT, 150, 200, 200, 2, 0, 400, TC_TMOT, R_FAIL, NULL },
|
||||||
/* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
|
/* 2 ipv4, fails after ~400ms, reports COULDNT_CONNECT */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef USE_IPV6
|
||||||
{ 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
|
{ 3, TURL, "test.com:123:::1", CURL_IPRESOLVE_WHATEVER,
|
||||||
CNCT_TMOT, 150, 200, 200, 0, 1, 200, TC_TMOT, R_FAIL, NULL },
|
CNCT_TMOT, 150, 200, 200, 0, 1, 200, TC_TMOT, R_FAIL, NULL },
|
||||||
/* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
|
/* 1 ipv6, fails after ~200ms, reports COULDNT_CONNECT */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user