Don't log errors for unknown hostnames

When a client connects to MaxScale and authentication fails, an error
about hostname resolution is logged. This happens because the
authentication first tries to resolve the address as an IP address, then
an IPv6-mapped-IPv4 address and finally as a hostname. If users have not
been loaded, the authentication is guaranteed to fail on the first attempt
due to the lazy loading of users.
This commit is contained in:
Markus Mäkelä
2017-12-21 09:39:49 +02:00
parent ee00539366
commit 0f015e6341

View File

@ -698,15 +698,11 @@ static bool get_hostname(DCB *dcb, char *client_hostname, size_t size)
NI_NAMEREQD); // Text address only
freeaddrinfo(ai);
if (lookup_result != 0)
if (lookup_result != 0 && lookup_result != EAI_NONAME)
{
MXS_ERROR("Client hostname lookup failed for '%s', getnameinfo() returned: '%s'.",
dcb->remote, gai_strerror(lookup_result));
}
else
{
MXS_DEBUG("IP-lookup success, hostname is: '%s'", client_hostname);
}
return lookup_result == 0;
}