OpenVPN
|
Go to the source code of this file.
Functions | |
static bool | dns_server_port_parse (in_port_t *port, char *port_str) |
Parses a string as port and stores it. More... | |
bool | dns_server_addr_parse (struct dns_server *server, const char *addr) |
Parses a string IPv4 or IPv6 address and optional colon separated port, into a in_addr or in6_addr respectively plus a in_port_t port. More... | |
void | dns_domain_list_append (struct dns_domain **entry, char **domains, struct gc_arena *gc) |
Appends DNS domain parameters to a linked list. More... | |
bool | dns_server_priority_parse (long *priority, const char *str, bool pulled) |
Parses a string DNS server priority and validates it. More... | |
struct dns_server * | dns_server_get (struct dns_server **entry, long priority, struct gc_arena *gc) |
Find or create DNS server with priority in a linked list. More... | |
bool | dns_options_verify (int msglevel, const struct dns_options *o) |
Checks validity of DNS options. More... | |
static struct dns_domain * | clone_dns_domains (const struct dns_domain *domain, struct gc_arena *gc) |
static struct dns_server * | clone_dns_servers (const struct dns_server *server, struct gc_arena *gc) |
struct dns_options | clone_dns_options (const struct dns_options o, struct gc_arena *gc) |
Makes a deep copy of the passed DNS options. More... | |
void | dns_options_preprocess_pull (struct dns_options *o) |
Saves and resets the server options, so that pulled ones don't mix in. More... | |
void | dns_options_postprocess_pull (struct dns_options *o) |
Merges pulled DNS servers with static ones into an ordered list. More... | |
static const char * | dnssec_value (const enum dns_security dnssec) |
static const char * | transport_value (const enum dns_server_transport transport) |
static void | setenv_dns_option (struct env_set *es, const char *format, int i, int j, const char *value) |
void | setenv_dns_options (const struct dns_options *o, struct env_set *es) |
Puts the DNS options into an environment set. More... | |
void | show_dns_options (const struct dns_options *o) |
Prints configured DNS options. More... | |
|
static |
Definition at line 214 of file dns.c.
References ALLOC_OBJ_CLEAR_GC, and dns_domain::next.
Referenced by clone_dns_options(), and clone_dns_servers().
struct dns_options clone_dns_options | ( | const struct dns_options | o, |
struct gc_arena * | gc | ||
) |
Makes a deep copy of the passed DNS options.
o | Pointer to the DNS options to clone |
gc | Pointer to the gc_arena to use for the clone |
Definition at line 251 of file dns.c.
References clone_dns_domains(), clone_dns_servers(), dns_options::gc, dns_options::search_domains, dns_options::servers, and dns_options::servers_prepull.
Referenced by pre_connect_restore(), and pre_connect_save().
|
static |
Definition at line 232 of file dns.c.
References ALLOC_OBJ_CLEAR_GC, clone_dns_domains(), dns_server::domains, and dns_server::next.
Referenced by clone_dns_options().
void dns_domain_list_append | ( | struct dns_domain ** | entry, |
char ** | domains, | ||
struct gc_arena * | gc | ||
) |
Appends DNS domain parameters to a linked list.
entry | Address of the first list entry pointer |
domains | Address of the first domain parameter |
gc | The gc the new list items should be allocated in |
Definition at line 141 of file dns.c.
References ALLOC_OBJ_CLEAR_GC, dns_domain::name, and dns_domain::next.
Referenced by add_option().
void dns_options_postprocess_pull | ( | struct dns_options * | o | ) |
Merges pulled DNS servers with static ones into an ordered list.
o | Pointer to the DNS options to modify |
Definition at line 269 of file dns.c.
References dns_server::next, dns_server::priority, dns_options::servers, and dns_options::servers_prepull.
Referenced by options_postprocess_pull().
void dns_options_preprocess_pull | ( | struct dns_options * | o | ) |
Saves and resets the server options, so that pulled ones don't mix in.
o | Pointer to the DNS options to modify |
Definition at line 262 of file dns.c.
References dns_options::servers, and dns_options::servers_prepull.
Referenced by options_postprocess_mutate().
bool dns_options_verify | ( | int | msglevel, |
const struct dns_options * | o | ||
) |
Checks validity of DNS options.
msglevel | The message level to log errors with |
o | Pointer to the DNS options to validate |
Definition at line 197 of file dns.c.
References dns_server::addr_count, msg, dns_server::next, dns_server::priority, dns_options::servers, and dns_options::servers_prepull.
Referenced by options_postprocess_pull(), and options_postprocess_verify().
bool dns_server_addr_parse | ( | struct dns_server * | server, |
const char * | addr | ||
) |
Parses a string IPv4 or IPv6 address and optional colon separated port, into a in_addr or in6_addr respectively plus a in_port_t port.
server | Pointer to DNS server the address is parsed for |
addr | Address as string |
Definition at line 55 of file dns.c.
References dns_server_addr::a4, dns_server_addr::a6, dns_server::addr, dns_server::addr_count, dns_server_port_parse(), dns_server_addr::family, dns_server_addr::in, openvpn_getaddrinfo(), dns_server_addr::port, and SIZE.
Referenced by add_option().
struct dns_server* dns_server_get | ( | struct dns_server ** | entry, |
long | priority, | ||
struct gc_arena * | gc | ||
) |
Find or create DNS server with priority in a linked list.
The list is ordered by priority.
entry | Address of the first list entry pointer |
priority | Priority of the DNS server to find / create |
gc | The gc new list items should be allocated in |
Definition at line 175 of file dns.c.
References ALLOC_OBJ_CLEAR_GC, dns_server::next, and dns_server::priority.
Referenced by add_option().
|
static |
Parses a string as port and stores it.
port | Pointer to in_port_t where the port value is stored |
addr | Port number as string |
Definition at line 41 of file dns.c.
Referenced by dns_server_addr_parse().
bool dns_server_priority_parse | ( | long * | priority, |
const char * | str, | ||
bool | pulled | ||
) |
Parses a string DNS server priority and validates it.
priority | Pointer to where the priority should be stored |
str | Priority string to parse |
pulled | Whether this was pulled from a server |
Definition at line 160 of file dns.c.
Referenced by add_option().
|
static |
Definition at line 305 of file dns.c.
References DNS_SECURITY_NO, DNS_SECURITY_OPTIONAL, DNS_SECURITY_YES, and dns_server::dnssec.
Referenced by setenv_dns_options(), and show_dns_options().
|
static |
Definition at line 343 of file dns.c.
References es, M_WARN, msg, and setenv_str().
Referenced by setenv_dns_options().
void setenv_dns_options | ( | const struct dns_options * | o, |
struct env_set * | es | ||
) |
Puts the DNS options into an environment set.
o | Pointer to the DNS options to set |
es | Pointer to the env_set to set the options into |
Definition at line 368 of file dns.c.
References dns_server_addr::a4, dns_server_addr::a6, dns_server::addr, dns_server::addr_count, dns_server::dnssec, dnssec_value(), dns_server::domains, es, dns_server_addr::family, gc_free(), gc_new(), dns_server_addr::in, dns_domain::name, dns_domain::next, dns_server::next, dns_server_addr::port, print_in6_addr(), print_in_addr_t(), print_in_port_t(), dns_options::search_domains, dns_options::servers, setenv_dns_option(), dns_server::sni, dns_server::transport, and transport_value().
Referenced by options_postprocess_pull(), and setenv_settings().
void show_dns_options | ( | const struct dns_options * | o | ) |
Prints configured DNS options.
o | Pointer to the DNS options to print |
Definition at line 430 of file dns.c.
References dns_server_addr::a4, dns_server_addr::a6, dns_server::addr, dns_server::addr_count, D_SHOW_PARMS, dns_server::dnssec, dnssec_value(), dns_server::domains, dns_server_addr::family, gc_free(), gc_new(), dns_server_addr::in, msg, dns_domain::name, dns_domain::next, dns_server::next, dns_server_addr::port, print_in6_addr(), print_in_addr_t(), print_in_port_t(), dns_options::search_domains, dns_options::servers, dns_options::servers_prepull, dns_server::sni, dns_server::transport, and transport_value().
Referenced by show_settings().
|
static |
Definition at line 324 of file dns.c.
References DNS_TRANSPORT_HTTPS, DNS_TRANSPORT_PLAIN, DNS_TRANSPORT_TLS, and dns_server::transport.
Referenced by setenv_dns_options(), and show_dns_options().