1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
Files
mariadb/sql
Praveenkumar Hulakund 42e69057d8 Bug#12762885: 61713: MYSQL WILL NOT BIND TO "LOCALHOST" IF LOCALHOST IS BOTH
IPV4/IPV6 ENABLED

Analysis:
----------------------
The problem was that if a hostname resolves to more than one IP-address,
the server (5.5) does not start due to an error. In 5.1 the server used to
take some IP-address and start.

It's a regression and should be fixed.

5.5 supports IPv6, while 5.1 does not. However, that should not 
prevent the server from start -- if a hostname has both IPv4 and IPv6 addresses,
the server should choose some IPv4-address and start.

It's been decided to prefer IPv4-address to be backward compatible with 5.1.

Another problem was that the 5.6 server did not report proper error message
when the specified hostname could not be resolved. So, the code has been 
changed to report proper error message.

Testing
================================
5.5
=============================
invalid hostname (localhos):
  => Following error message reported.
     120308 15:52:09 [ERROR] Can't start server: cannot resolve hostname!
     120308 15:52:09 [ERROR] Aborting

invalid ip_address:
  => Following error message reported.
      120308 15:56:06 [Note] Server hostname (bind-address): '123.123.123.123'; port: 3306
      120308 15:56:06 [Note]   - '123.123.123.123' resolves to '123.123.123.123';
      120308 15:56:06 [Note] Server socket created on IP: '123.123.123.123'.
      120308 15:56:06 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address

Only ipv4 host configured:
  => Following message logged 
    120308 16:02:50 [Note] Server hostname (bind-address): 'localhost'; port: 3306
    120308 16:02:50 [Note]   - 'localhost' resolves to '127.0.0.1';
    120308 16:02:50 [Note] Server socket created on IP: '127.0.0.1'

Only ipv6 host configured:    
  => Following message logged 
    120308 16:04:03 [Note] Server hostname (bind-address): 'localhost'; port: 3306
    120308 16:04:03 [Note]   - 'localhost' resolves to '::1';
    120308 16:04:03 [Note] Server socket created on IP: '::1'.

ipv4 and ipv6 host configured:
  => Following message logged
    120308 16:05:02 [Note] Server hostname (bind-address): 'localhost'; port: 3306
    120308 16:05:02 [Note]   - 'localhost' resolves to '::1';
    120308 16:05:02 [Note]   - 'localhost' resolves to '127.0.0.1';
    120308 16:05:02 [Note] Server socket created on IP: '127.0.0.1'.
  => Non localhost address  
    120308 16:08:20 [Note] Server hostname (bind-address): 'mysql_addr'; port: 3306
    120308 16:08:20 [Note]   - 'mysql_addr' resolves to '10.178.58.216';
    120308 16:08:20 [Note]   - 'mysql_addr' resolves to 'fe80::120b:a9ff:fe69:59ec';
    120308 16:08:20 [Note] Server socket created on IP: '10.178.58.216'.

More than one entry for ipv4 and ipv6 address:
  => Following message logged
    120308 16:06:19 [Note] Server hostname (bind-address): 'localhost'; port: 3306
    120308 16:06:19 [Note]   - 'localhost' resolves to '::1';
    120308 16:06:19 [Note]   - 'localhost' resolves to '::1';
    120308 16:06:19 [Note]   - 'localhost' resolves to '127.0.0.1';
    120308 16:06:19 [Note]   - 'localhost' resolves to '127.0.0.1';
    120308 16:06:19 [Note] Server socket created on IP: '127.0.0.1'.
2012-04-04 11:13:42 +05:30
..
2011-06-30 17:31:31 +02:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:21:38 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-05-21 10:21:08 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2012-02-15 17:21:38 +01:00
2011-11-18 14:53:54 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-22 11:50:44 +04:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-24 11:55:28 +05:30
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:37:13 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-03 17:47:37 +02:00
2012-03-27 14:55:29 +02:00
2012-02-15 17:13:47 +01:00
2011-06-30 17:46:53 +02:00
2012-02-29 14:15:15 +05:30
2012-02-29 14:15:15 +05:30
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-29 14:15:15 +05:30
2012-02-29 14:15:15 +05:30
2012-03-12 22:02:50 +00:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-03 17:47:37 +02:00
2012-02-15 17:21:38 +01:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:31:31 +02:00
2011-06-30 17:46:53 +02:00
2011-07-03 17:47:37 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:21:38 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2012-03-12 22:02:50 +00:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-03 17:47:37 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2012-03-06 13:47:57 +01:00
2012-03-12 22:02:50 +00:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-10-12 15:07:15 +03:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-03-07 10:08:10 +01:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:13:47 +01:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:37:13 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:13:47 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-06 01:13:50 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-11-17 09:00:58 +01:00
2010-12-07 16:11:13 +00:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:13:47 +01:00
2011-07-03 17:47:37 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-03-27 15:20:14 +05:30
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-15 17:13:47 +01:00
2011-07-03 17:47:37 +02:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-07-04 01:25:49 +02:00
2011-03-07 10:08:10 +01:00
2012-02-16 10:48:16 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:37:13 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2012-02-16 10:48:16 +01:00
2012-03-27 14:55:29 +02:00
2012-01-27 13:21:21 +01:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-06-30 17:46:53 +02:00
2011-07-04 01:25:49 +02:00
2012-02-15 17:21:38 +01:00