Bug #102356 python mysql.connector with IPv6 only system
Submitted: 24 Jan 2021 0:36 Modified: 14 Feb 2022 13:46
Reporter: Robert Cray Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:7.1 OS:Ubuntu
Assigned to: CPU Architecture:Any
Tags: ipv6

[24 Jan 2021 0:36] Robert Cray
Description:
When making a connection using the python mysql.connector on an IPv6 only system to an IPv4 only database.

The IPv6 client is using DNS64/NAT64 to reach the IPv4 only server

The connection fails unless force_ipv6=True is set.  This is the incorrect behavior.

In a DNS64/NAT64 scenario, the DNS server will create a synthesized "AAAA" record iff an "A" record exists but a "AAAA" does not.  In this scenario the API queries for both "A" and "AAAA" record - the "A" record will not be reachable.

Pre-existing code will typically not have force_ipv6=True (it will be left as default).

How to repeat:
Connect on IPV6 only client to IPv4 only server using DNS64/NAT64

Suggested fix:
If an "AAAA" record is available, it should always be used.
[14 Feb 2022 13:46] MySQL Verification Team
Hello Robert Cray,

Thank you for the bug report.
Imho this is an expected behavior, not a bug. Please check the documentation available https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html
 
Argument Name   Default   Description
force_ipv6 	False 	  When set to True, uses IPv6 when an address resolves to both IPv4 and IPv6. By default, IPv4 is used in such cases.

Regards,
Ashwini Patil