List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:February 12 2008 12:25pm
Subject:Re: bk commit into 6.0 tree (vvaintroub:1.2551) BUG#34381
View as plain text  
Patch approved. Maybe you can write "Turn off IPV6_V6ONLY" instead of 
"Remove..." if you recommit it again to get it attached to the bug 
report. Good that you moved the init of "arg" to just before the three 
places where it's used.


/ Magnus

vvaintroub@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 6.0 repository of vvaintroub.  When vvaintroub does a push these changes
> will be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
> 
> ChangeSet@stripped, 2008-02-12 12:15:45+01:00, vvaintroub@wva. +2 -0
>   Bug#34381
>   Client application cannot connect to server on Windows Vista
>   The problem was that the server is creating an IPv6 socket and listens
>   only to IPv6 traffic. If an older client application tries to connect to
>   server using IPv4 address (like 127.0.0.1 for localhost), it fails.
>   
>   The solution is to clear IPV6_V6ONLY socket option before bind() - in 
>   this case we will have dual-mode socket that accepts both IPv4 and IPv6
>   traffic. 
>   This is done for all operating systems where IPV6_V6ONLY is defined.
>   Although RFC3493 recommends to set IPV6_V6ONLY "off" by default and many 
>   follow the recommendation, on Vista it is "on" for compatibility reasons 
>   (separate IPv4 and IPv6 stacks in prior version). On FreeBSD  the setting
>   can be controlled via sysctrl
> 
>   include/config-win.h@stripped, 2008-02-12 12:15:43+01:00, vvaintroub@wva. +5 -0
>     Ensure IPV6_V6ONLY is defined,also when using pre-Vista Platform SDKs.
> 
>   sql/mysqld.cc@stripped, 2008-02-12 12:15:43+01:00, vvaintroub@wva. +17 -1
>     Clear IPV6_V6ONLY  flag for IPV6 listening socket to 
>     ensure compatibility  with existing clients. On many operating systems 
>     like Linux it is not needed (dual mode socket is default), but at least
>     Windows Vista requires it.
> 
> diff -Nrup a/include/config-win.h b/include/config-win.h
> --- a/include/config-win.h	2007-12-18 15:36:13 +01:00
> +++ b/include/config-win.h	2008-02-12 12:15:43 +01:00
> @@ -93,6 +93,11 @@ functions */
>  
>  #define S_IROTH		S_IREAD		/* for my_lib */
>  
> +/* Winsock2 constant (Vista SDK and later)*/
> +#ifndef IPV6_V6ONLY
> +#define IPV6_V6ONLY 27
> +#endif
> +
>  #ifdef __BORLANDC__
>  #define FILE_BINARY	O_BINARY	/* my_fopen in binary mode */
>  #define O_TEMPORARY	0
> diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc
> --- a/sql/mysqld.cc	2008-02-08 17:02:57 +01:00
> +++ b/sql/mysqld.cc	2008-02-12 12:15:43 +01:00
> @@ -1612,7 +1612,7 @@ static void network_init(void)
>  #ifdef HAVE_SYS_UN_H
>    struct sockaddr_un	UNIXaddr;
>  #endif
> -  int	arg=1;
> +  int	arg;
>    int   ret;
>    uint  waited;
>    uint  this_wait;
> @@ -1663,8 +1663,23 @@ static void network_init(void)
>        We should not use SO_REUSEADDR on windows as this would enable a
>        user to open two mysqld servers with the same TCP/IP port.
>      */
> +    arg= 1;
>      (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
>  #endif /* __WIN__ */
> +
> +#ifdef IPV6_V6ONLY
> +     /*
> +       For interoperability with older clients, IPv6 socket should
> +       listen on both IPv6 and IPv4 wildcard addresses.
> +       Remove IPV6_V6ONLY option.
> +     */
> +    if (ai->ai_family == AF_INET6)
> +    {
> +      arg= 0;      
> +      (void) setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
> +                sizeof(arg));
> +    }
> +#endif
>      /*
>        Sometimes the port is not released fast enough when stopping and
>        restarting the server. This happens quite often with the test suite
> @@ -1773,6 +1788,7 @@ static void network_init(void)
>      UNIXaddr.sun_family = AF_UNIX;
>      strmov(UNIXaddr.sun_path, mysqld_unix_port);
>      (void) unlink(mysqld_unix_port);
> +    arg= 1;
>      (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,
>  		      sizeof(arg));
>      umask(0);
> 
> 
> 

Thread
bk commit into 6.0 tree (vvaintroub:1.2551) BUG#34381vvaintroub12 Feb
  • Re: bk commit into 6.0 tree (vvaintroub:1.2551) BUG#34381Magnus Svensson12 Feb