|
OpenVPN
|
DNS resolution. More...


Go to the source code of this file.
Data Structures | |
| struct | cached_dns_entry |
Macros | |
| #define | GETADDR_RESOLVE (1u << 0) |
| #define | GETADDR_FATAL (1u << 1) |
| #define | GETADDR_HOST_ORDER (1u << 2) |
| #define | GETADDR_MENTION_RESOLVE_RETRY (1u << 3) |
| #define | GETADDR_FATAL_ON_SIGNAL (1u << 4) |
| #define | GETADDR_WARN_ON_SIGNAL (1u << 5) |
| #define | GETADDR_MSG_VIRT_OUT (1u << 6) |
| #define | GETADDR_TRY_ONCE (1u << 7) |
| #define | GETADDR_UPDATE_MANAGEMENT_STATE (1u << 8) |
| #define | GETADDR_RANDOMIZE (1u << 9) |
| #define | GETADDR_PASSIVE (1u << 10) |
| #define | GETADDR_DATAGRAM (1u << 11) |
| #define | GETADDR_CACHE_MASK (GETADDR_DATAGRAM | GETADDR_PASSIVE) |
Functions | |
| unsigned int | sf2gaf (const unsigned int getaddr_flags, const unsigned int sockflags) |
| Convert sockflags/getaddr_flags into getaddr_flags. | |
| in_addr_t | getaddr (unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded, struct signal_info *sig_info) |
| Translate an IPv4 addr or hostname from string form to in_addr_t. | |
| in_addr_t | get_ip_addr (const char *ip_string, msglvl_t msglevel, bool *error) |
| bool | get_ipv6_addr (const char *hostname, struct in6_addr *network, unsigned int *netbits, msglvl_t msglevel) |
| Translate an IPv6 addr or hostname from string form to in6_addr. | |
| static bool | ipv6_addr_safe_hexplusbits (const char *ipv6_prefix_spec) |
| int | openvpn_getaddrinfo (unsigned int flags, const char *hostname, const char *servname, int resolve_retry_seconds, struct signal_info *sig_info, int ai_family, struct addrinfo **res) |
| void | do_preresolve (struct context *c) |
| int | get_cached_dns_entry (struct cached_dns_entry *dns_cache, const char *hostname, const char *servname, int ai_family, unsigned int resolve_flags, struct addrinfo **ai) |
| get_cached_dns_entry return 0 on success and -1 otherwise. | |
DNS resolution.
Definition in file resolve.h.
| #define GETADDR_CACHE_MASK (GETADDR_DATAGRAM | GETADDR_PASSIVE) |
Definition at line 51 of file resolve.h.
Referenced by do_preresolve_host(), and get_cached_dns_entry().
| #define GETADDR_DATAGRAM (1u << 11) |
Definition at line 49 of file resolve.h.
Referenced by do_preresolve(), openvpn_getaddrinfo(), resolve_bind_local(), and resolve_remote().
| #define GETADDR_FATAL (1u << 1) |
Definition at line 39 of file resolve.h.
Referenced by do_preresolve(), get_ip_addr(), init_tun(), man_settings_init(), openvpn_getaddrinfo(), resolve_bind_local(), and resolve_remote().
| #define GETADDR_FATAL_ON_SIGNAL (1u << 4) |
Definition at line 42 of file resolve.h.
Referenced by init_tun(), and openvpn_getaddrinfo().
| #define GETADDR_HOST_ORDER (1u << 2) |
Definition at line 40 of file resolve.h.
Referenced by add_host_route_array(), add_option(), get_adapter_ip_netmask(), get_addr_generic(), get_ip_addr(), ifconfig_pool_read(), init_route(), init_route_list(), init_tun(), ip_addr_string_to_array(), man_kill(), openvpn_getaddrinfo(), option_iroute(), and remove_iroutes_from_push_route_list().
| #define GETADDR_MENTION_RESOLVE_RETRY (1u << 3) |
Definition at line 41 of file resolve.h.
Referenced by do_preresolve(), openvpn_getaddrinfo(), and resolve_remote().
| #define GETADDR_MSG_VIRT_OUT (1u << 6) |
Definition at line 44 of file resolve.h.
Referenced by man_kill(), and openvpn_getaddrinfo().
| #define GETADDR_PASSIVE (1u << 10) |
Definition at line 48 of file resolve.h.
Referenced by do_preresolve(), man_settings_init(), management_post_tunnel_open(), openvpn_getaddrinfo(), and resolve_bind_local().
| #define GETADDR_RANDOMIZE (1u << 9) |
Definition at line 47 of file resolve.h.
Referenced by do_preresolve(), openvpn_getaddrinfo(), and sf2gaf().
| #define GETADDR_RESOLVE (1u << 0) |
Definition at line 38 of file resolve.h.
Referenced by add_option(), do_preresolve(), get_ipv6_addr(), init_route(), init_route_list(), init_tun(), man_settings_init(), openvpn_getaddrinfo(), resolve_bind_local(), and resolve_remote().
| #define GETADDR_TRY_ONCE (1u << 7) |
Definition at line 45 of file resolve.h.
Referenced by openvpn_getaddrinfo(), and resolve_remote().
| #define GETADDR_UPDATE_MANAGEMENT_STATE (1u << 8) |
Definition at line 46 of file resolve.h.
Referenced by do_preresolve(), openvpn_getaddrinfo(), and resolve_remote().
| #define GETADDR_WARN_ON_SIGNAL (1u << 5) |
Definition at line 43 of file resolve.h.
Referenced by init_route(), init_route_list(), man_settings_init(), openvpn_getaddrinfo(), and resolve_bind_local().
| void do_preresolve | ( | struct context * | c | ) |
Definition at line 573 of file resolve.c.
References connection_entry::af, connection_list::array, local_list::array, connection_entry::bind_local, options::connection_list, do_preresolve_host(), connection_entry::flags, GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_MENTION_RESOLVE_RETRY, GETADDR_PASSIVE, GETADDR_RANDOMIZE, GETADDR_RESOLVE, GETADDR_UPDATE_MANAGEMENT_STATE, connection_entry::http_proxy_options, options::ip_remote_hint, connection_list::len, local_list::len, local_entry::local, connection_entry::local_list, context::options, http_proxy_options::port, local_entry::port, connection_entry::proto, proto_is_dgram(), connection_entry::remote, connection_entry::remote_port, http_proxy_options::server, SF_HOST_RANDOMIZE, SIGHUP, options::sockflags, connection_entry::socks_proxy_port, connection_entry::socks_proxy_server, status, and throw_signal_soft().
Referenced by init_instance().
| int get_cached_dns_entry | ( | struct cached_dns_entry * | dns_cache, |
| const char * | hostname, | ||
| const char * | servname, | ||
| int | ai_family, | ||
| unsigned int | resolve_flags, | ||
| struct addrinfo ** | ai ) |
get_cached_dns_entry return 0 on success and -1 otherwise.
(like getaddrinfo())
Definition at line 506 of file resolve.c.
References cached_dns_entry::ai, cached_dns_entry::ai_family, cached_dns_entry::flags, GETADDR_CACHE_MASK, cached_dns_entry::hostname, cached_dns_entry::next, cached_dns_entry::servname, and streqnull().
Referenced by do_preresolve_host(), resolve_bind_local(), and resolve_remote().
Definition at line 469 of file resolve.c.
References getaddr(), GETADDR_FATAL, GETADDR_HOST_ORDER, and M_FATAL.
Referenced by add_option(), and dhcp_option_address_parse().
| bool get_ipv6_addr | ( | const char * | hostname, |
| struct in6_addr * | network, | ||
| unsigned int * | netbits, | ||
| msglvl_t | msglevel ) |
Translate an IPv6 addr or hostname from string form to in6_addr.
Definition at line 489 of file resolve.c.
References get_addr_generic(), and GETADDR_RESOLVE.
Referenced by add_option(), dhcp_option_dns6_parse(), ifconfig_pool_read(), init_route_ipv6(), ipv6_addr_safe_hexplusbits(), option_iroute_ipv6(), and remove_iroutes_from_push_route_list().
| in_addr_t getaddr | ( | unsigned int | flags, |
| const char * | hostname, | ||
| int | resolve_retry_seconds, | ||
| bool * | succeeded, | ||
| struct signal_info * | sig_info ) |
Translate an IPv4 addr or hostname from string form to in_addr_t.
In case of resolve error, it will try again for resolve_retry_seconds seconds.
Definition at line 442 of file resolve.c.
References get_addr_generic(), M_WARN, and status.
Referenced by add_client_nat_to_option_list(), add_host_route_array(), add_option(), get_adapter_ip_netmask(), get_ip_addr(), ifconfig_pool_read(), init_route(), init_route_list(), init_tun(), ip_addr_string_to_array(), man_kill(), option_iroute(), and remove_iroutes_from_push_route_list().
|
inlinestatic |
Definition at line 76 of file resolve.h.
References get_ipv6_addr(), and M_WARN.
Referenced by check_route6_option().
| int openvpn_getaddrinfo | ( | unsigned int | flags, |
| const char * | hostname, | ||
| const char * | servname, | ||
| int | resolve_retry_seconds, | ||
| struct signal_info * | sig_info, | ||
| int | ai_family, | ||
| struct addrinfo ** | res ) |
Definition at line 102 of file resolve.c.
References ASSERT, CLEAR, D_RESOLVE_ERRORS, D_SOCKET_DEBUG, dmsg, gc, gc_free(), gc_new(), get_signal(), GETADDR_DATAGRAM, GETADDR_FATAL, GETADDR_FATAL_ON_SIGNAL, GETADDR_HOST_ORDER, GETADDR_MENTION_RESOLVE_RETRY, GETADDR_MSG_VIRT_OUT, GETADDR_PASSIVE, GETADDR_RANDOMIZE, GETADDR_RESOLVE, GETADDR_TRY_ONCE, GETADDR_UPDATE_MANAGEMENT_STATE, GETADDR_WARN_ON_SIGNAL, getaddrinfo_addr_family_name(), hostname_randomize(), M_FATAL, M_MSG_VIRT_OUT, M_WARN, management_set_state(), management_sleep(), msg, OPENVPN_STATE_RESOLVE, signal_info::signal_received, signal_reset(), SIGUSR1, and status.
Referenced by dns_server_addr_parse(), do_preresolve_host(), get_addr_generic(), init_route(), man_settings_init(), management_post_tunnel_open(), resolve_bind_local(), and resolve_remote().
| unsigned int sf2gaf | ( | const unsigned int | getaddr_flags, |
| const unsigned int | sockflags ) |
Convert sockflags/getaddr_flags into getaddr_flags.
Definition at line 42 of file resolve.c.
References GETADDR_RANDOMIZE, and SF_HOST_RANDOMIZE.
Referenced by resolve_remote().