MySQL 5.6.14 Source Code Document
|
Get hostname for an IP address. More...
#include "my_global.h"
#include "sql_priv.h"
#include "hostname.h"
#include "hash_filo.h"
#include <m_ctype.h>
#include "log.h"
#include "violite.h"
#include <sys/utsname.h>
Go to the source code of this file.
Functions | |
void | hostname_cache_refresh () |
uint | hostname_cache_size () |
void | hostname_cache_resize (uint size) |
bool | hostname_cache_init () |
void | hostname_cache_free () |
void | hostname_cache_lock () |
void | hostname_cache_unlock () |
Host_entry * | hostname_cache_first () |
void | inc_host_errors (const char *ip_string, Host_errors *errors) |
void | reset_host_connect_errors (const char *ip_string) |
int | ip_to_hostname (struct sockaddr_storage *ip_storage, const char *ip_string, char **hostname, uint *connect_errors) |
Variables | |
ulong | host_cache_size |
Get hostname for an IP address.
Hostnames are checked with reverse name lookup and checked that they doesn't resemble an IP address.
Definition in file hostname.cc.
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:
NOTE: connect_errors are counted (are supported) only for the clients where IP-address can be resolved and FCrDNS check is passed.
[in] | ip_storage | IP address (sockaddr). Must be set. |
[in] | ip_string | IP address (string). Must be set. |
[out] | hostname | |
[out] | connect_errors |
0 | Success |
RC_BLOCKED_HOST | The host is blocked. |
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.
Definition at line 410 of file hostname.cc.
ulong host_cache_size |
The size of the host_cache.
Definition at line 127 of file hostname.cc.