Use RFC 3986 compliant addresses in log messages
When log messages are written with both address and port information, IPv6 addresses can cause confusion if the normal address:port formatting is used. The RFC 3986 suggests that all IPv6 addresses are expressed as a bracket enclosed address optionally followed by the port that is separate from the address by a colon. In practice, the "all interfaces" address and port number 3306 can be written in IPv4 numbers-and-dots notation as 0.0.0.0:3306 and in IPv6 notation as [::]:3306. Using the latter format in log messages keeps the output consistent with all types of addresses. The details of the standard can be found at the following addresses: https://www.ietf.org/rfc/rfc3986.txt https://www.rfc-editor.org/std/std66.txt
This commit is contained in:
@ -280,7 +280,7 @@ static int gw_do_connect_to_backend(char *host, int port, int *fd)
|
||||
|
||||
if (so == -1)
|
||||
{
|
||||
MXS_ERROR("Establishing connection to backend server %s:%d failed.", host, port);
|
||||
MXS_ERROR("Establishing connection to backend server [%s]:%d failed.", host, port);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ static int gw_do_connect_to_backend(char *host, int port, int *fd)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Failed to connect backend server %s:%d due to: %d, %s.",
|
||||
MXS_ERROR("Failed to connect backend server [%s]:%d due to: %d, %s.",
|
||||
host, port, errno, mxs_strerror(errno));
|
||||
close(so);
|
||||
return rv;
|
||||
@ -303,7 +303,7 @@ static int gw_do_connect_to_backend(char *host, int port, int *fd)
|
||||
|
||||
*fd = so;
|
||||
MXS_DEBUG("%lu [gw_do_connect_to_backend] Connected to backend server "
|
||||
"%s:%d, fd %d.", pthread_self(), host, port, so);
|
||||
"[%s]:%d, fd %d.", pthread_self(), host, port, so);
|
||||
|
||||
return rv;
|
||||
|
||||
|
Reference in New Issue
Block a user