3813 Alexander Nozdrin 2012-04-27
Proper follow-up for Bug#12762885 - 61713: MYSQL WILL NOT BIND TO "LOCALHOST"
IF LOCALHOST IS BOTH IPV4/IPV6 ENABLED.
The original patch removed default value of the bind-address option.
So, the default value became NULL. By coincedence NULL resolves
to 0.0.0.0 and ::, and since the server chooses first IPv4-address,
0.0.0.0 is choosen. So, there was no change in the behaviour.
This patch restores default value of the bind-address option to "0.0.0.0".
modified:
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
sql/mysqld.cc
sql/mysqld.h
sql/sys_vars.cc
3812 Alexander Nozdrin 2012-04-27
Follow-up for Bug#12762885 - 61713: MYSQL WILL NOT BIND TO "LOCALHOST"
IF LOCALHOST IS BOTH IPV4/IPV6 ENABLED.
The original patch removed default value of the bind-address option.
So, the default value became NULL. By coincedence NULL resolves
to 0.0.0.0 and ::, and since the server chooses first IPv4-address,
0.0.0.0 is choosen. So, there was no change in the behaviour.
This patch restores default value of the bind-address option to "0.0.0.0".
modified:
sql/mysqld.cc
=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2012-03-20 21:27:49 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2012-04-27 15:14:28 +0000
@@ -747,7 +747,7 @@ autocommit TRUE
automatic-sp-privileges TRUE
back-log 50
big-tables FALSE
-bind-address (No default value)
+bind-address 0.0.0.0
binlog-cache-size 32768
binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2012-03-20 21:27:49 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2012-04-27 15:14:28 +0000
@@ -755,7 +755,7 @@ autocommit TRUE
automatic-sp-privileges TRUE
back-log 50
big-tables FALSE
-bind-address (No default value)
+bind-address 0.0.0.0
binlog-cache-size 32768
binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2012-04-27 14:42:27 +0000
+++ b/sql/mysqld.cc 2012-04-27 15:14:28 +0000
@@ -341,7 +341,7 @@ static char *default_character_set_name;
static char *character_set_filesystem_name;
static char *lc_messages;
static char *lc_time_names_name;
-static char *my_bind_addr_str;
+char *my_bind_addr_str;
static char *default_collation_name;
char *default_storage_engine;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
@@ -1841,9 +1841,6 @@ static void network_init(void)
struct addrinfo *ai, *a;
struct addrinfo hints;
- if (!my_bind_addr_str)
- my_bind_addr_str= (char *) "0.0.0.0";
-
sql_print_information("Server hostname (bind-address): '%s'; port: %d",
my_bind_addr_str, mysqld_port);
@@ -5713,9 +5710,6 @@ struct my_option my_long_options[]=
{"autocommit", 0, "Set default value for autocommit (0 or 1)",
&opt_autocommit, &opt_autocommit, 0,
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, NULL},
- {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
- &my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, "
"and exclude all others not explicitly mentioned.",
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2012-02-16 09:48:16 +0000
+++ b/sql/mysqld.h 2012-04-27 15:14:28 +0000
@@ -146,6 +146,7 @@ extern char *opt_backup_history_logname,
extern const char *log_output_str;
extern const char *log_backup_output_str;
extern char *mysql_home_ptr, *pidfile_name_ptr;
+extern char *my_bind_addr_str;
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char default_logfile_name[FN_REFLEN];
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-02-28 08:32:27 +0000
+++ b/sql/sys_vars.cc 2012-04-27 15:14:28 +0000
@@ -308,6 +308,11 @@ static Sys_var_charptr Sys_basedir(
READ_ONLY GLOBAL_VAR(mysql_home_ptr), CMD_LINE(REQUIRED_ARG, 'b'),
IN_FS_CHARSET, DEFAULT(0));
+static Sys_var_charptr Sys_my_bind_addr(
+ "bind_address", "IP address to bind to.",
+ READ_ONLY GLOBAL_VAR(my_bind_addr_str), CMD_LINE(REQUIRED_ARG),
+ IN_FS_CHARSET, DEFAULT("0.0.0.0"));
+
static Sys_var_ulong Sys_binlog_cache_size(
"binlog_cache_size", "The size of the transactional cache for "
"updates to transactional engines for the binary log. "
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (alexander.nozdrin:3812 to 3813) Bug#12762885 | Alexander Nozdrin | 2 May |