diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 7642b937e05..c420419773d 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -24,8 +24,6 @@ return "No my_print_defaults" unless $epath; push @::global_suppressions, ( - qr(WSREP: Failed to guess base node address), - qr(WSREP: Guessing address for incoming client connections failed), qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), qr(WSREP: Could not open saved state file for reading: ), qr(WSREP: Gap in state sequence. Need state transfer.), diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm index 7b3b2db6836..02dff2420b3 100644 --- a/mysql-test/suite/wsrep/suite.pm +++ b/mysql-test/suite/wsrep/suite.pm @@ -24,8 +24,6 @@ return "No my_print_defaults" unless $epath; push @::global_suppressions, ( - qr(WSREP: Failed to guess base node address), - qr(WSREP: Guessing address for incoming client connections failed), qr(WSREP: Could not open saved state file for reading: ), qr(WSREP: option --wsrep-casual-reads is deprecated), qr(WSREP: --wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=0), diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index 2c3fc0d77fd..7172f77bfed 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -35,8 +35,9 @@ #include // getaddrinfo() #ifdef HAVE_GETIFADDRS +#include #include -#endif +#endif /* HAVE_GETIFADDRS */ extern char** environ; // environment variables @@ -406,6 +407,13 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len) return ip_len; } + /* + getifaddrs() is avaiable at least on Linux since glib 2.3, FreeBSD, + MAC OSX, OpenSolaris, Solaris. + + On platforms which do not support getifaddrs() this function returns + a failure and user is prompted to do manual configuration. + */ #if HAVE_GETIFADDRS struct ifaddrs *ifaddr, *ifa; if (getifaddrs(&ifaddr) == 0) @@ -415,10 +423,11 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len) if (!ifa->ifa_addr || ifa->ifa_addr->sa_family != AF_INET) // TODO AF_INET6 continue; - if (vio_getnameinfo(ifa->ifa_addr, buf, buf_len, NULL, 0, NI_NUMERICHOST)) + // Skip loopback interfaces (like lo:127.0.0.1) + if (ifa->ifa_flags & IFF_LOOPBACK) continue; - if (strcmp(buf, "127.0.0.1") == 0) // lame + if (vio_getnameinfo(ifa->ifa_addr, buf, buf_len, NULL, 0, NI_NUMERICHOST)) continue; freeifaddrs(ifaddr); @@ -426,23 +435,11 @@ size_t wsrep_guess_ip (char* buf, size_t buf_len) } freeifaddrs(ifaddr); } -#endif +#endif /* HAVE_GETIFADDRS */ return 0; } -size_t wsrep_guess_address(char* buf, size_t buf_len) -{ - size_t addr_len = wsrep_guess_ip (buf, buf_len); - - if (addr_len && addr_len < buf_len) { - addr_len += snprintf (buf + addr_len, buf_len - addr_len, - ":%u", mysqld_port); - } - - return addr_len; -} - /* * WSREPXid */ diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index 0e459c7d4b6..1cc65578202 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -21,7 +21,6 @@ unsigned int wsrep_check_ip (const char* addr); size_t wsrep_guess_ip (char* buf, size_t buf_len); -size_t wsrep_guess_address(char* buf, size_t buf_len); namespace wsp {