diff options
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r-- | sql/hostname.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc index fe2fad6f3b2..ec5c6f29a27 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -183,7 +183,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) that attempted to connect during the outage) unable to connect indefinitely. */ - if (tmp_errno == HOST_NOT_FOUND || tmp_error == NO_DATA) + if (tmp_errno == HOST_NOT_FOUND || tmp_errno == NO_DATA) add_wrong_ip(in); my_gethostbyname_r_free(); DBUG_RETURN(0); @@ -207,13 +207,17 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) { VOID(pthread_mutex_unlock(&LOCK_hostname)); DBUG_PRINT("error",("gethostbyaddr returned %d",errno)); - goto err; + + if (errno == HOST_NOT_FOUND || errno == NO_DATA) + add_wrong_ip(in); /* only cache negative responses, not failures */ + + DBUG_RETURN(0); } if (!hp->h_name[0]) // Don't allow empty hostnames { VOID(pthread_mutex_unlock(&LOCK_hostname)); DBUG_PRINT("error",("Got an empty hostname")); - goto err; + goto add_wrong_ip_and_return; } if (!(name=my_strdup(hp->h_name,MYF(0)))) { @@ -240,7 +244,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) { DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'")); my_free(name,MYF(0)); - goto err; + goto add_wrong_ip_and_return; } } @@ -256,7 +260,7 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) DBUG_PRINT("error",("Couldn't verify hostname with gethostbyname")); my_free(name,MYF(0)); -err: +add_wrong_ip_and_return: add_wrong_ip(in); DBUG_RETURN(0); } |