• Davi Arnaut's avatar
    Bug#45017: Failure to connect if hostname maps to multiple addresses · 543e8672
    Davi Arnaut authored
    The problem is that the C API function mysql_real_connect
    only attempts to connect to the first IP address returned
    for a hostname. This can be a problem if a hostname maps
    to multiple IP address and the server is not bound to the
    first one that is returned.
    
    The solution is to augment mysql_real_connect so that it
    attempts to connect to all IPv4 addresses that a domain
    name maps to. The function goes over the list of address
    until a successful connection is established.
    
    No test case is provided as its not possible to test this
    automatically with the current testing infrastructure.
    
    sql-common/client.c:
      The client will try to connect to each IPv4 address from
      the list of addresses that hostname maps to until a successful
      connection is established or there are no more address.
    543e8672
client.c 95.7 KB