|
void | hostname_cache_refresh () |
|
uint | hostname_cache_size () |
|
void | hostname_cache_resize (uint size) |
|
bool | hostname_cache_init (uint size) |
|
void | hostname_cache_free () |
|
void | hostname_cache_lock () |
|
void | hostname_cache_unlock () |
|
list< unique_ptr< Host_entry > >::iterator | hostname_cache_begin () |
|
list< unique_ptr< Host_entry > >::iterator | hostname_cache_end () |
|
static Host_entry * | hostname_cache_search (const char *ip_string) |
|
static void | add_hostname_impl (const char *ip_string, const char *hostname, bool validated, Host_errors *errors, ulonglong now) |
|
static void | add_hostname (const char *ip_string, const char *hostname, bool validated, Host_errors *errors) |
|
void | inc_host_errors (const char *ip_string, Host_errors *errors) |
|
void | reset_host_connect_errors (const char *ip_string) |
|
static bool | is_ip_loopback (const struct sockaddr *ip) |
|
static bool | is_hostname_valid (const char *hostname) |
|
int | ip_to_hostname (struct sockaddr_storage *ip_storage, const char *ip_string, char **hostname, uint *connect_errors) |
| Resolve IP-address to host name. More...
|
|
Get hostname for an IP address.
Hostnames are checked with reverse name lookup and checked that they doesn't resemble an IP address.
int ip_to_hostname |
( |
struct sockaddr_storage * |
ip_storage, |
|
|
const char * |
ip_string, |
|
|
char ** |
hostname, |
|
|
uint * |
connect_errors |
|
) |
| |
Resolve IP-address to host name.
This function does the following things:
- resolves IP-address;
- employs Forward Confirmed Reverse DNS technique to validate IP-address;
- returns host name if IP-address is validated;
- set value to out-variable connect_errors – this variable represents the number of connection errors from the specified IP-address.
- update the host_cache statistics
NOTE: connect_errors are counted (are supported) only for the clients where IP-address can be resolved and FCrDNS check is passed.
- Parameters
-
[in] | ip_storage | IP address (sockaddr). Must be set. |
[in] | ip_string | IP address (string). Must be set. |
[out] | hostname | Hostname if IP-address is valid. |
[out] | connect_errors | Represents number of connection errors. |
- Returns
- Error status
- Return values
-
0 | Success |
RC_BLOCKED_HOST | The host is blocked. |
RC_LONG_HOSTNAME | The hostname is longer than HOSTNAME_LENGTH. |
The function does not set/report MySQL server error in case of failure. It's caller's responsibility to handle failures of this function properly.