Bug #52381 | Cannot connect to server with IPv6 using hostname or IPv4 address | ||
---|---|---|---|
Submitted: | 26 Mar 2010 0:10 | Modified: | 4 Aug 2010 22:35 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.5.3-m3 | OS: | Windows (Server 2008) |
Assigned to: | Vladislav Vaintroub | CPU Architecture: | Any |
[26 Mar 2010 0:10]
Elena Stepanova
[26 Mar 2010 19:40]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/104487 3144 Vladislav Vaintroub 2010-03-26 Bug #52381 Cannot connect to server with IPv6 using hostname or IPv4 address The bug occurs on Visual Studio 2005. IPV6_V6ONLY TCP flag is not defined in the VS2005 SDK (it is an older pre-Vista one). The code in mysqld.cc responsible for creating dual-mode socket is enclosed into #ifdef IPV6_V6ONLY. When compiled with VS2005, v6only socket option is not cleared which results into server listening only on IPV6 address. There used to be a workaround for this problem, defining IPV6_V6ONLY expli citly when it is not defined in system headers. The system checks for it are already in place in CMake, but the results were precached (i.e check was effectively deactivated). The patch reactivates checks for IPV6_V6ONLY on pre-VS2008 Visual Studio. If these constants are not found, my_config.h will contain #define IPV6_V6ONLY 27 and this will make mysqld.cc compile with socket dual-mode again.
[8 Apr 2010 12:00]
Alexander Nozdrin
Hello, there are two issues here: 1. mysql -uroot --protocol=tcp --port=3306 --host=127.0.0.1 ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (10061) This is a build problem -- old compiler was used to build binaries. Wlad addressed this. 2. mysql -uroot --protocol=tcp --port=3306 --host=loki14 ERROR 1130 (HY000): Host 'fe80::358d:f4cd:8288:644e%10' is not allowed to connect to this MySQL server What happens here is the following: - client resolves 'loki14' to IPv6-address 'fe80::358d:f4cd:8288:644e%10' (5.5.2 resolved it to IPv4-address); - server resolves the IPv6-address to 'loki14.norway.sun.com' (FQDN, not hostname only); - server uses FCrDNS technique: - on the previous step IPv6-address resolved to hostname.domainname; - now the server tries to get IPv6-address back from hostname.domainname. So, server tries to verify that 'loki14.norway.sun.com' has that IPv6-address, but fails! getaddrinfo('loki14.norway.sun.com') returns IPv4-address only; getaddrinfo('loki14') returns both IPv4-address and IPv6-address. So, FCrDNS check fails, thus the server does not trust hostname resolved from the IPv6-address and does not use it for further authentication. The FCrDNS check fails because the host is misconfigured: its FQDN is just 'loki14' (set in My Computer properties), while it should be 'loki14.norway.sun.com'. This issue was reproduced locally on Windows 7. After setting "full computer name" in My Computer properties, everything works as expected. The error message displayed on the client is a bit misleading and probably should be corrected. However that requires additional efforts and it's not clear if the efforts worth it.
[16 Apr 2010 13:49]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/105879 3161 Vladislav Vaintroub 2010-04-16 Bug #52381 Cannot connect to server with IPv6 using hostname or IPv4 address The bug occurs on Visual Studio 2005. IPV6_V6ONLY TCP flag is not defined in the VS2005 SDK (it is an older pre-Vista one). The code in mysqld.cc responsible for creating dual-mode socket is enclosed into #ifdef IPV6_V6ONLY. When compiled with VS2005, v6only socket option is not cleared which results into server listening only on IPV6 address. There used to be a workaround for this problem, defining IPV6_V6ONLY expli citly when it is not defined in system headers. The system checks for it are already in place in CMake, but the results were precached (i.e check was effectively deactivated). The patch reactivates checks for IPV6_V6ONLY on pre-VS2008 Visual Studio. If these constants are not found, my_config.h will contain #define IPV6_V6ONLY 27 and this will make mysqld.cc compile with socket dual-mode again.
[16 Apr 2010 13:58]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/105882 3161 Vladislav Vaintroub 2010-04-16 Bug #52381 Cannot connect to server with IPv6 using hostname or IPv4 address The bug occurs on Visual Studio 2005. IPV6_V6ONLY TCP flag is not defined in the VS2005 SDK (it is an older pre-Vista one). The code in mysqld.cc responsible for creating dual-mode socket is enclosed into #ifdef IPV6_V6ONLY. When compiled with VS2005, v6only socket option is not cleared which results into server listening only on IPV6 address. There used to be a workaround for this problem, defining IPV6_V6ONLY expli citly when it is not defined in system headers. The system checks for it are already in place in CMake, but the results were precached (i.e check was effectively deactivated). The patch reactivates checks for IPV6_V6ONLY on pre-VS2008 Visual Studio. If these constants are not found, my_config.h will contain #define IPV6_V6ONLY 27 and this will make mysqld.cc compile with socket dual-mode again.
[16 Apr 2010 14:04]
Vladislav Vaintroub
pushed to next-mr-bugfixing, 6.0-codebase-bugfixing
[27 Apr 2010 7:31]
Alexander Nozdrin
Bug#52411 has been closed as a duplicate of this bug.
[27 Apr 2010 9:46]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100427094135-5s49ecp3ckson6e2) (version source revid:alik@sun.com-20100427093843-uekr85qkd7orx12t) (merge vers: 6.0.14-alpha) (pib:16)
[27 Apr 2010 9:51]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100427094036-38frbg3famdlvjup) (version source revid:alik@sun.com-20100427093825-92wc8b22d4yg34ju) (pib:16)
[12 May 2010 1:39]
Paul DuBois
Noted in 6.0.14 changelog. On Windows, an IPv6 connection to the server could not be made using an IPv4 address or host name.
[4 Aug 2010 8:03]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804080001-bny5271e65xo34ig) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 8:20]
Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@ibmvm-20100804081533-c1d3rbipo9e8rt1s) (version source revid:alik@sun.com-20100427095914-pzlxbqjjtnngxmf0) (merge vers: 5.6.99-m4) (pib:18)
[4 Aug 2010 22:35]
Paul DuBois
Noted in 5.6.0 changelog.