From dc849d1c0fa574a3bfb5ddb4edc8513acf70ddce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 27 Jun 2017 21:27:20 +0300 Subject: [PATCH] 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. --- server/core/dcb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/core/dcb.c b/server/core/dcb.c index d14b60534..e5d4c26c0 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -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 {