mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Third attempt to do a follow-up for Bug#12762885 - 61713: MYSQL WILL NOT BIND
TO "LOCALHOST" IF LOCALHOST IS BOTH IPV4/IPV6 ENABLED. Previous commit comments were wrong. The default value has always been NULL. The original patch for Bug#12762885 just makes it visible in the logs. This patch uses "0.0.0.0" string if bind-address is not set.
This commit is contained in:
@ -1840,9 +1840,13 @@ static void network_init(void)
|
|||||||
{
|
{
|
||||||
struct addrinfo *ai, *a;
|
struct addrinfo *ai, *a;
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
|
const char *bind_address= my_bind_addr_str;
|
||||||
|
|
||||||
|
if (!bind_address)
|
||||||
|
bind_address= "0.0.0.0";
|
||||||
|
|
||||||
sql_print_information("Server hostname (bind-address): '%s'; port: %d",
|
sql_print_information("Server hostname (bind-address): '%s'; port: %d",
|
||||||
my_bind_addr_str, mysqld_port);
|
bind_address, mysqld_port);
|
||||||
|
|
||||||
// Get list of IP-addresses associated with the server hostname.
|
// Get list of IP-addresses associated with the server hostname.
|
||||||
bzero(&hints, sizeof (hints));
|
bzero(&hints, sizeof (hints));
|
||||||
@ -1851,7 +1855,7 @@ static void network_init(void)
|
|||||||
hints.ai_family= AF_UNSPEC;
|
hints.ai_family= AF_UNSPEC;
|
||||||
|
|
||||||
my_snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
|
my_snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
|
||||||
if (getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai))
|
if (getaddrinfo(bind_address, port_buf, &hints, &ai))
|
||||||
{
|
{
|
||||||
sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
|
sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
|
||||||
sql_print_error("Can't start server: cannot resolve hostname!");
|
sql_print_error("Can't start server: cannot resolve hostname!");
|
||||||
@ -1871,7 +1875,7 @@ static void network_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sql_print_information(" - '%s' resolves to '%s';",
|
sql_print_information(" - '%s' resolves to '%s';",
|
||||||
my_bind_addr_str, ip_addr);
|
bind_address, ip_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user