mirror of
https://github.com/curl/curl.git
synced 2026-08-25 04:23:36 +03:00
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
47 changed files with 197 additions and 196 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue