Bug #83649 | IPv6 connections do not work | ||
---|---|---|---|
Submitted: | 2 Nov 2016 11:11 | Modified: | 15 Oct 2019 7:50 |
Reporter: | Michiel Hazelhof | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 7.0.6m5 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | ipv6 |
[2 Nov 2016 11:11]
Michiel Hazelhof
[3 Nov 2016 6:13]
Chiranjeevi Battula
Hello Michiel Hazelhof, Thank you for the bug report. Verified as described. Thanks, Chiranjeevi.
[3 Nov 2016 9:04]
Michiel Hazelhof
Temporary fix, not the greatest (I *hope* that TcpClient should be able to handle it just by the hostname, but apperantely I cannot find the correct settings to do so). private static Stream GetTcpStream(MySqlConnectionStringBuilder settings) { IPHostEntry host = Dns.GetHostEntry(settings.Server); foreach (IPAddress ipAddress in host.AddressList) { if (ipAddress.AddressFamily != AddressFamily.InterNetwork && ipAddress.AddressFamily != AddressFamily.InterNetworkV6) continue; TcpClient client = new TcpClient(ipAddress.AddressFamily); Task task = client.ConnectAsync(settings.Server, (int)settings.Port); if (!task.Wait(((int)settings.ConnectionTimeout * 1000))) throw new MySqlException(Resources.Timeout); return client.GetStream(); //TODO: reimplement or remove keepalive } throw new MySqlConversionException(Resources.UnableToConnectToHost); }
[4 Nov 2016 12:16]
Michiel Hazelhof
Quick fix to support ip based hosts: IPAddress parsed; IPAddress.TryParse(settings.Server, out parsed); IPHostEntry host = parsed != null ? new IPHostEntry { AddressList = new[] { parsed } } : Dns.GetHostEntry(settings.Server);
[14 Oct 2019 17:28]
Bradley Grainger
Should this bug now be closed because it's fixed in 8.0.18? https://dev.mysql.com/doc/relnotes/connector-net/en/news-8-0-18.html > Connector/NET now supports IPV6 connections made using the classic MySQL protocol when the operating system on the server host also supports IPV6. (Bug #29682333)
[15 Oct 2019 7:50]
Michiel Hazelhof
Verified working, can be closed