Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 62497 invoked from network); 13 Apr 2011 15:39:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Apr 2011 15:39:06 -0000 Received: (qmail 90120 invoked by uid 500); 13 Apr 2011 15:39:06 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 90073 invoked by uid 500); 13 Apr 2011 15:39:06 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 90066 invoked by uid 99); 13 Apr 2011 15:39:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2011 15:39:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2011 15:39:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CE426238890A; Wed, 13 Apr 2011 15:38:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1091824 - in /apr/apr/branches/1.5.x/network_io/win32: sockets.c sockopt.c Date: Wed, 13 Apr 2011 15:38:42 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110413153842.CE426238890A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Wed Apr 13 15:38:42 2011 New Revision: 1091824 URL: http://svn.apache.org/viewvc?rev=1091824&view=rev Log: grab 1091757 from trunk: IPV6_V6ONLY on Windows: * Deal with SDKs which don't have the symbol definition * Deal with old run-time platforms which don't implement the option and have hard-coded behavior internally (option always on) Behavior changes: run on Windows >= Vista, SDK has IPV6_V6ONLY: no change in behavior run on Windows >= Vista, SDK doesn't have IPV6_V6ONLY: works just like SDK had the def'n (will return APR_SUCCESS on IPv6 socket instead of WSAENOPROTOOPT) run on Windows < Vista, regardless of SDK: socket_opt_get/set(APR_IPV6_V6ONLY) reflect stack behavior (always on) previously, if IPV6_V6ONLY was defined: set returned WSAENOPROTOOPT previously, if IPV6_V6ONLY was not defined: set returned APR_ENOTIMPL previously, regardless of IPV6_V6ONLY presence: get returned not-enabled now: get always returns enabled; set returns APR_SUCCESS when enabling, APR_ENOTIMPL when trying to disable PR: 45321 Submitted by: Sob Tweaked by: trawick Modified: apr/apr/branches/1.5.x/network_io/win32/sockets.c apr/apr/branches/1.5.x/network_io/win32/sockopt.c Modified: apr/apr/branches/1.5.x/network_io/win32/sockets.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/win32/sockets.c?rev=1091824&r1=1091823&r2=1091824&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/win32/sockets.c (original) +++ apr/apr/branches/1.5.x/network_io/win32/sockets.c Wed Apr 13 15:38:42 2011 @@ -51,6 +51,12 @@ static void set_socket_vars(apr_socket_t sock->protocol = protocol; apr_sockaddr_vars_set(sock->local_addr, family, 0); apr_sockaddr_vars_set(sock->remote_addr, family, 0); +#if APR_HAVE_IPV6 + /* hard-coded behavior for older Windows IPv6 */ + if (apr_os_level < APR_WIN_VISTA && family == AF_INET6) { + apr_set_option(sock, APR_IPV6_V6ONLY, 1); + } +#endif } static void alloc_socket(apr_socket_t **new, apr_pool_t *p) { Modified: apr/apr/branches/1.5.x/network_io/win32/sockopt.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/win32/sockopt.c?rev=1091824&r1=1091823&r2=1091824&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/win32/sockopt.c (original) +++ apr/apr/branches/1.5.x/network_io/win32/sockopt.c Wed Apr 13 15:38:42 2011 @@ -15,11 +15,20 @@ */ #include "apr_arch_networkio.h" +#include "apr_arch_misc.h" /* apr_os_level */ #include "apr_network_io.h" #include "apr_general.h" #include "apr_strings.h" #include +/* IPV6_V6ONLY is missing from pre-Windows 2008 SDK as well as MinGW + * (at least up through 1.0.16). + * Runtime support is a separate issue. + */ +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + static apr_status_t soblock(SOCKET sd) { u_long zero = 0; @@ -195,7 +204,17 @@ APR_DECLARE(apr_status_t) apr_socket_opt } break; case APR_IPV6_V6ONLY: -#if APR_HAVE_IPV6 && defined(IPV6_V6ONLY) +#if APR_HAVE_IPV6 + if (apr_os_level < APR_WIN_VISTA && + sock->local_addr->family == AF_INET6) { + /* apr_set_option() called at socket creation */ + if (on) { + return APR_SUCCESS; + } + else { + return APR_ENOTIMPL; + } + } /* we don't know the initial setting of this option, * so don't check sock->options since that optimization * won't work