MXS-1291: Attempt to bind on 0.0.0.0 when :: fails

If binding on the IPv6 all interfaces address fails, MaxScale will attempt
to bind on the IPv4 address.
This commit is contained in:
Markus Mäkelä 2017-06-27 21:27:20 +03:00
parent 1df8fda93f
commit dc849d1c0f

View File

@ -3067,6 +3067,15 @@ int dcb_listen(DCB *listener, const char *config, const char *protocol_name)
else if (port > 0)
{
listener_socket = dcb_listen_create_socket_inet(host, port);
if (listener_socket == -1 && strcmp(host, "::") == 0)
{
/** Attempt to bind to the IPv4 if the default IPv6 one is used */
MXS_WARNING("Failed to bind on default IPv6 host '::', attempting "
"to bind on IPv4 version '0.0.0.0'");
strcpy(host, "0.0.0.0");
listener_socket = dcb_listen_create_socket_inet(host, port);
}
}
else
{