summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2022-12-08 15:12:08 +0100
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2022-12-08 15:12:08 +0100
commit76c98223c5a700724ca12dee99b94c2736c4f8b5 (patch)
tree56d059f29f9cf98deb302b6d0a0ef1533456eecb /sql/mysqld.cc
parentdd5f4b3625def2ee74d8f9a6b55d1368ba597a84 (diff)
downloadmariadb-git-bb-10.6-MDEV-6536-addendum.tar.gz
MDEV-6536 addendum: special handling of localhostbb-10.6-MDEV-6536-addendum
Linux and glibc return only the local ipv4 address for localhost unless an alternative ipv6 address is explicitly entered in /etc/hosts...
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 988ffd678f4..81d4bee3bf0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2269,8 +2269,12 @@ static void activate_tcp_port(uint port,
hints.ai_socktype= SOCK_STREAM;
hints.ai_family= AF_UNSPEC;
- if (my_bind_addr_str && strcmp(my_bind_addr_str, "*") == 0)
+ if (my_bind_addr_str && (strcmp(my_bind_addr_str, "*") == 0 ||
+ strcmp(my_bind_addr_str, "localhost") == 0))
real_bind_addr_str= NULL; // windows doesn't seem to support * here
+ // and linux returns only ipv4 for localhost
+ // unless /etc/host is edited to add an ipv6
+ // alternative address.
else
real_bind_addr_str= my_bind_addr_str;