Bind admin interface to IPv4 if IPv6 fails

The default interface for the admin interface is the IPv6 address '::'
which corresponds to the IPv4 address '0.0.0.0'. If the system doesn't
support IPv6, then an attempt to bind on IPv4 should be made.
This commit is contained in:
Markus Mäkelä
2017-08-24 15:08:14 +03:00
parent 894ef3d3a9
commit 0e89e445f2

View File

@ -2062,7 +2062,17 @@ int main(int argc, char **argv)
if (cnf->admin_enabled)
{
if (mxs_admin_init())
bool success = mxs_admin_init();
if (!success && strcmp(cnf->admin_host, "::") == 0)
{
MXS_WARNING("Failed to bind on address '::', attempting to "
"bind on IPv4 address '0.0.0.0'.");
strcpy(cnf->admin_host, "0.0.0.0");
success = mxs_admin_init();
}
if (success)
{
MXS_NOTICE("Started REST API on [%s]:%u", cnf->admin_host, cnf->admin_port);
}
@ -2075,7 +2085,6 @@ int main(int argc, char **argv)
}
}
MXS_NOTICE("MaxScale started with %d worker threads, each with a stack size of %lu bytes.",
n_threads, thread_stack_size);