From f5530752bf161db9fa0ac31e94bb3b33828aca0c Mon Sep 17 00:00:00 2001 From: mtortonesi Date: Wed, 20 Apr 2005 18:26:33 -0700 Subject: [PATCH] [svn] Set IPV6_V6ONLY socket option when -6 switch is used. --- configure.in | 1 + src/ChangeLog | 4 ++++ src/connect.c | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/configure.in b/configure.in index becfba3c..20ad4c6b 100644 --- a/configure.in +++ b/configure.in @@ -51,6 +51,7 @@ AC_DEFINE_UNQUOTED([OS_TYPE], "$host_os", dnl dnl Process features. dnl +_AS_PATH_SEPARATOR_PREPARE AC_ARG_WITH(ssl, [[ --with-ssl[=SSL-ROOT] link with SSL support [default=auto] diff --git a/src/ChangeLog b/src/ChangeLog index 7327a4bd..b5b26d34 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-04-20 Mauro Tortonesi + + * connect.c: Set IPV6_V6ONLY socket option when -6 switch is used. + 2005-04-20 FUJISHIMA Satsuki * http.c (request_set_header): Fix the check whether a new header diff --git a/src/connect.c b/src/connect.c index 10f98406..1aab01bb 100644 --- a/src/connect.c +++ b/src/connect.c @@ -283,6 +283,18 @@ connect_to_ip (const ip_address *ip, int port, const char *print) if (sock < 0) goto err; +#if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY) + if (opt.ipv6_only) { + int on = 1; + /* In case of error, we will go on anyway... */ + int err = setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on)); +#ifdef ENABLE_DEBUG + if (err < 0) + DEBUGP (("Failed setting IPV6_V6ONLY: %s", strerror (errno))); +#endif + } +#endif + /* For very small rate limits, set the buffer size (and hence, hopefully, the kernel's TCP window size) to the per-second limit. That way we should never have to sleep for more than 1s between -- 2.39.2