OpenVPN
|
#include "syshead.h"
#include "win32.h"
#include "init.h"
#include "run_command.h"
#include "sig.h"
#include "occ.h"
#include "list.h"
#include "otime.h"
#include "pool.h"
#include "gremlin.h"
#include "pkcs11.h"
#include "ps.h"
#include "lladdr.h"
#include "ping.h"
#include "mstats.h"
#include "ssl_verify.h"
#include "ssl_ncp.h"
#include "tls_crypt.h"
#include "forward.h"
#include "auth_token.h"
#include "mss.h"
#include "mudp.h"
#include "dco.h"
#include "memdbg.h"
Go to the source code of this file.
Macros | |
#define | CF_LOAD_PERSISTED_PACKET_ID (1<<0) |
#define | CF_INIT_TLS_MULTI (1<<1) |
#define | CF_INIT_TLS_AUTH_STANDALONE (1<<2) |
Functions | |
static void | do_init_first_time (struct context *c) |
static bool | do_deferred_p2p_ncp (struct context *c) |
void | context_clear (struct context *c) |
void | context_clear_1 (struct context *c) |
void | context_clear_2 (struct context *c) |
void | context_clear_all_except_first_time (struct context *c) |
static void | run_up_down (const char *command, const struct plugin_list *plugins, int plugin_type, const char *arg, DWORD adapter_index, const char *dev_type, int tun_mtu, const char *ifconfig_local, const char *ifconfig_remote, const char *context, const char *signal_text, const char *script_type, struct env_set *es) |
static void | update_options_ce_post (struct options *options) |
static bool | management_callback_proxy_cmd (void *arg, const char **p) |
static bool | ce_management_query_proxy (struct context *c) |
static bool | management_callback_send_cc_message (void *arg, const char *command, const char *parameters) |
This method sends a custom control channel message. More... | |
static unsigned int | management_callback_remote_entry_count (void *arg) |
static bool | management_callback_remote_entry_get (void *arg, unsigned int index, char **remote) |
static bool | management_callback_remote_cmd (void *arg, const char **p) |
static bool | ce_management_query_remote (struct context *c) |
static void | init_connection_list (struct context *c) |
static void | clear_remote_addrlist (struct link_socket_addr *lsa, bool free) |
static void | next_connection_entry (struct context *c) |
void | init_query_passwords (const struct context *c) |
Query for private key and auth-user-pass username/passwords. More... | |
static void | uninit_proxy_dowork (struct context *c) |
static void | init_proxy_dowork (struct context *c) |
static void | init_proxy (struct context *c) |
static void | uninit_proxy (struct context *c) |
void | context_init_1 (struct context *c) |
void | context_gc_free (struct context *c) |
bool | init_static (void) |
void | uninit_static (void) |
void | init_verb_mute (struct context *c, unsigned int flags) |
void | init_options_dev (struct options *options) |
bool | print_openssl_info (const struct options *options) |
bool | do_genkey (const struct options *options) |
bool | do_persist_tuntap (struct options *options, openvpn_net_ctx_t *ctx) |
bool | possibly_become_daemon (const struct options *options) |
static void | do_uid_gid_chroot (struct context *c, bool no_delay) |
const char * | format_common_name (struct context *c, struct gc_arena *gc) |
void | pre_setup (const struct options *options) |
void | reset_coarse_timers (struct context *c) |
static void | do_init_server_poll_timeout (struct context *c) |
static void | do_init_timers (struct context *c, bool deferred) |
static void | do_init_traffic_shaper (struct context *c) |
static void | do_alloc_route_list (struct context *c) |
static void | do_init_route_list (const struct options *options, struct route_list *route_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx) |
static void | do_init_route_ipv6_list (const struct options *options, struct route_ipv6_list *route_ipv6_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx) |
void | initialization_sequence_completed (struct context *c, const unsigned int flags) |
bool | do_route (const struct options *options, struct route_list *route_list, struct route_ipv6_list *route_ipv6_list, const struct tuntap *tt, const struct plugin_list *plugins, struct env_set *es, openvpn_net_ctx_t *ctx) |
static void | do_init_tun (struct context *c) |
static bool | can_preserve_tun (struct tuntap *tt) |
static void | add_wfp_block (struct context *c) |
Add WFP filters to block traffic to local networks. More... | |
static void | del_wfp_block (struct context *c, unsigned long adapter_index) |
Remove any WFP block filters previously added. More... | |
static bool | do_open_tun (struct context *c, int *error_flags) |
static void | do_close_tun_simple (struct context *c) |
static void | do_close_tun (struct context *c, bool force) |
void | tun_abort (void) |
static bool | options_hash_changed_or_zero (const struct sha256_digest *a, const struct sha256_digest *b) |
Helper for do_up(). More... | |
static bool | p2p_set_dco_keepalive (struct context *c) |
static void | add_delim_if_non_empty (struct buffer *buf, const char *header) |
Helper function for tls_print_deferred_options_results Adds the ", " delimitor if there already some data in the buffer. More... | |
static void | tls_print_deferred_options_results (struct context *c) |
Prints the results of options imported for the data channel. More... | |
static bool | do_deferred_options_part2 (struct context *c) |
This function is expected to be invoked after open_tun() was performed. More... | |
bool | do_up (struct context *c, bool pulled_options, unsigned int option_types_found) |
unsigned int | pull_permission_mask (const struct context *c) |
bool | do_deferred_options (struct context *c, const unsigned int found) |
static bool | do_hold (int holdtime) |
static void | socket_restart_pause (struct context *c) |
static void | do_startup_pause (struct context *c) |
static size_t | get_frame_mtu (struct context *c, const struct options *o) |
static void | frame_finalize_options (struct context *c, const struct options *o) |
static void | key_schedule_free (struct key_schedule *ks, bool free_ssl_ctx) |
static void | init_crypto_pre (struct context *c, const unsigned int flags) |
static void | do_init_crypto_static (struct context *c, const unsigned int flags) |
static void | do_init_tls_wrap_key (struct context *c) |
static void | do_init_crypto_tls_c1 (struct context *c) |
static void | do_init_crypto_tls (struct context *c, const unsigned int flags) |
static void | do_init_frame_tls (struct context *c) |
static void | do_init_crypto_none (struct context *c) |
static void | do_init_crypto (struct context *c, const unsigned int flags) |
static void | do_init_frame (struct context *c) |
static void | do_option_warnings (struct context *c) |
struct context_buffers * | init_context_buffers (const struct frame *frame) |
void | free_context_buffers (struct context_buffers *b) |
static void | do_init_buffers (struct context *c) |
static void | do_init_fragment (struct context *c) |
static void | do_link_socket_new (struct context *c) |
static void | do_print_data_channel_mtu_parms (struct context *c) |
static void | do_compute_occ_strings (struct context *c) |
static void | do_close_free_buf (struct context *c) |
static void | do_close_tls (struct context *c) |
static void | do_close_free_key_schedule (struct context *c, bool free_ssl_ctx) |
static void | do_close_link_socket (struct context *c) |
static void | do_close_packet_id (struct context *c) |
static void | do_close_fragment (struct context *c) |
static void | do_event_set_init (struct context *c, bool need_us_timeout) |
static void | do_close_event_set (struct context *c) |
static void | do_open_status_output (struct context *c) |
static void | do_close_status_output (struct context *c) |
static void | do_open_ifconfig_pool_persist (struct context *c) |
static void | do_close_ifconfig_pool_persist (struct context *c) |
static void | do_inherit_env (struct context *c, const struct env_set *src) |
static void | do_env_set_destroy (struct context *c) |
static void | do_setup_fast_io (struct context *c) |
static void | do_signal_on_tls_errors (struct context *c) |
void | init_plugins (struct context *c) |
void | open_plugins (struct context *c, const bool import_options, int init_point) |
static void | do_close_plugins (struct context *c) |
static void | do_inherit_plugins (struct context *c, const struct context *src) |
static void | management_callback_status_p2p (void *arg, const int version, struct status_output *so) |
void | management_show_net_callback (void *arg, const int msglevel) |
void | init_management_callback_p2p (struct context *c) |
void | init_management (void) |
bool | open_management (struct context *c) |
void | close_management (void) |
void | uninit_management_callback (void) |
void | persist_client_stats (struct context *c) |
void | init_instance_handle_signals (struct context *c, const struct env_set *env, const unsigned int flags) |
void | init_instance (struct context *c, const struct env_set *env, const unsigned int flags) |
void | close_instance (struct context *c) |
void | inherit_context_child (struct context *dest, const struct context *src) |
void | inherit_context_top (struct context *dest, const struct context *src) |
void | close_context (struct context *c, int sig, unsigned int flags) |
void | write_pid_file (const char *filename, const char *chroot_dir) |
void | remove_pid_file (void) |
static void * | test_crypto_thread (void *arg) |
bool | do_test_crypto (const struct options *o) |
Variables | |
static struct context * | static_context |
static const char * | saved_pid_file_name |
|
static |
Helper function for tls_print_deferred_options_results Adds the ", " delimitor if there already some data in the buffer.
Definition at line 2208 of file init.c.
References buf_len(), and buf_printf().
Referenced by tls_print_deferred_options_results().
|
static |
Add WFP filters to block traffic to local networks.
Depending on the configuration all or just DNS is filtered. This functionality is only available on Windows on all other systems this function is a noop.
c | pointer to the connection context |
Definition at line 1796 of file init.c.
References tuntap::adapter_index, block_local_needed(), options::block_outside_dns, context::c1, M_FATAL, msg, options::msg_channel, context::options, context_1::route_list, context_1::tuntap, and win_wfp_block().
Referenced by do_open_tun().
|
static |
|
static |
Definition at line 256 of file init.c.
References alloc_buf_gc(), BSTR, buf_printf(), options::ce, CE_MAN_QUERY_PROXY, options::connection_list, connection_list::current, connection_entry::flags, gc_free(), gc_new(), IS_SIG, management_event_loop_n_seconds(), management_notify_generic(), np(), context::options, management::persist, connection_entry::proto, proto_is_udp(), connection_entry::remote, man_persist::special_state_msg, and update_time().
Referenced by next_connection_entry().
|
static |
Definition at line 423 of file init.c.
References connection_entry::af, alloc_buf_gc(), BSTR, buf_printf(), options::ce, CE_MAN_QUERY_REMOTE_MASK, CE_MAN_QUERY_REMOTE_QUERY, CE_MAN_QUERY_REMOTE_SHIFT, CE_MAN_QUERY_REMOTE_SKIP, connection_entry::flags, gc_free(), gc_new(), IS_SIG, management_event_loop_n_seconds(), management_notify_generic(), np(), context::options, management::persist, connection_entry::proto, proto2ascii(), connection_entry::remote, connection_entry::remote_port, man_persist::special_state_msg, and update_time().
Referenced by next_connection_entry().
|
static |
Definition at line 498 of file init.c.
References link_socket_addr::current_remote, and link_socket_addr::remote_list.
Referenced by do_close_link_socket(), and next_connection_entry().
void close_context | ( | struct context * | c, |
int | sig, | ||
unsigned int | flags | ||
) |
Definition at line 4914 of file init.c.
References ASSERT, CC_GC_FREE, CC_HARD_USR1_TO_HUP, CC_NO_CLOSE, CC_USR1_TO_HUP, close_instance(), context_gc_free(), register_signal(), context::sig, SIG_SOURCE_HARD, signal_info::signal_received, and signal_info::source.
Referenced by init_instance(), multi_close_instance(), and multi_top_free().
void close_instance | ( | struct context * | c | ) |
Definition at line 4711 of file init.c.
References context::c2, CM_CHILD_TCP, CM_CHILD_UDP, CM_P2P, CM_TOP, dco_remove_peer(), do_close_event_set(), do_close_fragment(), do_close_free_buf(), do_close_free_key_schedule(), do_close_ifconfig_pool_persist(), do_close_link_socket(), do_close_packet_id(), do_close_plugins(), do_close_status_output(), do_close_tls(), do_close_tun(), do_env_set_destroy(), context_2::gc, gc_free(), management_notify_client_close(), context_2::mda_context, context::mode, and uninit_proxy().
Referenced by close_context(), tunnel_point_to_point(), tunnel_server_tcp(), and tunnel_server_udp().
void close_management | ( | void | ) |
Definition at line 4345 of file init.c.
References management_close().
Referenced by open_management(), and openvpn_main().
void context_clear | ( | struct context * | c | ) |
Definition at line 76 of file init.c.
References CLEAR.
Referenced by context_clear_all_except_first_time(), and do_test_crypto().
void context_clear_1 | ( | struct context * | c | ) |
Definition at line 82 of file init.c.
References context::c1, and CLEAR.
Referenced by context_init_1().
void context_clear_2 | ( | struct context * | c | ) |
Definition at line 88 of file init.c.
References context::c2, and CLEAR.
Referenced by tunnel_point_to_point(), tunnel_server_tcp(), and tunnel_server_udp().
void context_clear_all_except_first_time | ( | struct context * | c | ) |
Definition at line 94 of file init.c.
References context_clear(), context::first_time, and context::persist.
Referenced by openvpn_main().
void context_gc_free | ( | struct context * | c | ) |
Definition at line 777 of file init.c.
References context::c2, context_2::gc, options::gc, context::gc, gc_free(), and context::options.
Referenced by close_context(), openvpn_main(), and test_crypto_thread().
void context_init_1 | ( | struct context * | c | ) |
Definition at line 730 of file init.c.
References context::c1, CLEAR, context_clear_1(), context::first_time, get_user_pass(), GET_USER_PASS_MANAGEMENT, GET_USER_PASS_NEED_OK, init_connection_list(), M_INFO, MAX_PARMS, msg, context::options, packet_id_persist_init(), user_pass::password, context_1::pid_persist, and user_pass::username.
Referenced by openvpn_main(), and test_crypto_thread().
|
static |
Remove any WFP block filters previously added.
This functionality is only available on Windows on all other systems the function is a noop.
c | pointer to the connection context |
adapter_index | the VPN adapter index |
Definition at line 1822 of file init.c.
References block_local_needed(), options::block_outside_dns, context::c1, M_FATAL, msg, options::msg_channel, context::options, context_1::route_list, and win_wfp_uninit().
Referenced by do_close_tun().
|
static |
Definition at line 1448 of file init.c.
References ALLOC_OBJ_CLEAR_GC, context::c1, context::gc, context::options, context_1::route_ipv6_list, context_1::route_list, and options::routes_ipv6.
Referenced by do_open_tun().
|
static |
Definition at line 3984 of file init.c.
References context::c2, event_free(), context_2::event_set, and context_2::event_set_owned.
Referenced by close_instance().
|
static |
Definition at line 3950 of file init.c.
References context::c2, context_2::fragment, and fragment_free().
Referenced by close_instance().
|
static |
Definition at line 3819 of file init.c.
References context_2::buffers, context_2::buffers_owned, context::c2, and free_context_buffers().
Referenced by close_instance().
|
static |
Definition at line 3860 of file init.c.
References buf_clear(), context::c1, CLEAR, free_buf(), free_key_ctx(), free_key_ctx_bi(), key_schedule_free(), context_1::ks, context::sig, signal_info::signal_received, key_schedule::tls_crypt_v2_server_key, key_schedule::tls_crypt_v2_wkc, and key_schedule::tls_wrap_key.
Referenced by close_instance().
|
static |
Definition at line 4041 of file init.c.
References context::c1, context_1::ifconfig_pool_persist, ifconfig_pool_persist_close(), context_1::ifconfig_pool_persist_owned, context::sig, and signal_info::signal_received.
Referenced by close_instance().
|
static |
Definition at line 3882 of file init.c.
References link_socket_addr::actual, link_socket_addr::bind_local, context::c1, context::c2, CLEAR, clear_remote_addrlist(), link_socket_addr::current_remote, context_2::link_socket, context_1::link_socket_addr, link_socket_close(), context_2::link_socket_owned, options::no_advance, context::options, options::persist_local_ip, options::persist_remote_ip, options::resolve_in_advance, link_socket::sd, context::sig, SIG_SOURCE_HARD, signal_info::signal_received, SOCKET_UNDEFINED, signal_info::source, context_1::tuntap, and tuntap_is_dco_win().
Referenced by close_instance().
|
static |
Definition at line 3935 of file init.c.
References context::c1, context::c2, context_2::crypto_options, crypto_options::packet_id, packet_id_free(), packet_id_persist_close(), packet_id_persist_save(), context_1::pid_persist, context::sig, and signal_info::signal_received.
Referenced by close_instance().
|
static |
Definition at line 4175 of file init.c.
References plugin_list_close(), context::plugins, context::plugins_owned, context::sig, and signal_info::signal_received.
Referenced by close_instance().
|
static |
Definition at line 4013 of file init.c.
References context::c1, context::sig, signal_info::signal_received, status_close(), context_1::status_output, and context_1::status_output_owned.
Referenced by close_instance().
|
static |
Definition at line 3833 of file init.c.
References context::c2, md_ctx_cleanup(), md_ctx_free(), context_2::options_string_local, context_2::options_string_remote, context_2::pulled_options_state, context_2::tls_auth_standalone, tls_auth_standalone_free(), context_2::tls_multi, and tls_multi_free().
Referenced by close_instance().
|
static |
Definition at line 2028 of file init.c.
References tuntap::actual_name, tuntap::adapter_index, context::c1, context::c2, del_wfp_block(), delete_routes(), do_close_tun_simple(), options::down_pre, options::down_script, context_2::es, context_2::frame, gc_free(), gc_new(), IA_EMPTY_IF_UNDEF, is_tun_type_set(), tuntap::local, management_pre_tunnel_close(), management_up_down(), context::net_ctx, OPENVPN_PLUGIN_DOWN, OPENVPN_PLUGIN_ROUTE_PREDOWN, context::options, options::persist_tun, context::plugins, print_in_addr_t(), tuntap::remote_netmask, context_1::route_ipv6_list, context_1::route_list, ROUTE_OPTION_FLAGS, options::route_predown_script, run_up_down(), context::sig, signal_description(), signal_info::signal_received, signal_info::signal_text, static_context, string_alloc(), frame::tun_mtu, context_1::tuntap, tuntap_is_dco_win(), context_1::tuntap_owned, and options::up_restart.
Referenced by close_instance(), do_up(), and tun_abort().
|
static |
Definition at line 2009 of file init.c.
References context::c1, CLEAR, close_tun(), D_CLOSE, dco_enabled(), options::ifconfig_noexec, msg, context::net_ctx, context::options, context_1::pulled_options_digest_save, context_1::tuntap, context_1::tuntap_owned, and undo_ifconfig().
Referenced by do_close_tun().
|
static |
Definition at line 3752 of file init.c.
References context::c1, context::c2, D_SHOW_OCC, context_2::frame, gc_free(), gc_new(), msg, context::net_ctx, context::options, options_string(), context_2::options_string_local, context_2::options_string_remote, options_string_version(), context_2::tls_multi, tls_multi_init_set_options(), and context_1::tuntap.
Referenced by init_instance().
bool do_deferred_options | ( | struct context * | c, |
const unsigned int | found | ||
) |
Definition at line 2593 of file init.c.
References context::c2, options::ce, check_compression_settings_valid(), check_pull_client_ncp(), options::comp, D_PUSH, D_PUSH_DEBUG, D_PUSH_ERRORS, dco_check_pull_options(), dco_enabled(), do_init_timers(), do_init_traffic_shaper(), connection_entry::explicit_exit_notification, context_2::frame, init_verb_mute(), IVM_LEVEL_1, IVM_LEVEL_2, context_2::link_socket, link_socket_update_buffer_sizes(), link_socket_update_flags(), min_int(), msg, OPT_P_COMP, OPT_P_DHCPDNS, OPT_P_EXPLICIT_NOTIFY, OPT_P_MESSAGES, OPT_P_PEER_ID, OPT_P_PERSIST, OPT_P_PUSH_MTU, OPT_P_ROUTE, OPT_P_ROUTE_EXTRAS, OPT_P_SETENV, OPT_P_SHAPER, OPT_P_SOCKBUF, OPT_P_SOCKFLAGS, OPT_P_TIMER, OPT_P_UP, context::options, tls_multi::peer_id, options::peer_id, connection_entry::proto, proto_is_udp(), options::pull, options::rcvbuf, options::sndbuf, options::sockflags, context_2::tls_multi, frame::tun_max_mtu, connection_entry::tun_mtu, frame::tun_mtu, and tls_multi::use_peer_id.
Referenced by do_up(), and multi_client_connect_late_setup().
|
static |
This function is expected to be invoked after open_tun() was performed.
This kind of behaviour is required by DCO, because the following operations can be done only after the DCO device was created and the new peer was properly added.
Definition at line 2348 of file init.c.
References context::c2, options::ce, D_TLS_ERRORS, connection_entry::fragment, context_2::frame, context_2::frame_fragment, get_link_socket_info(), msg, context::options, tls_multi::session, context_2::tls_multi, tls_session_update_crypto_params(), and TM_ACTIVE.
Referenced by do_up().
|
static |
Definition at line 2545 of file init.c.
References context::c2, options::ce, options::ciphername, D_TLS_ERRORS, options::enable_ncp_fallback, connection_entry::fragment, context_2::frame, context_2::frame_fragment, options::gc, get_link_socket_info(), get_p2p_ncp_cipher(), msg, context::options, tls_multi::peer_info, tls_multi::session, context_2::tls_multi, tls_session_update_crypto_params(), TM_ACTIVE, tls_multi::use_peer_id, and options::use_peer_id.
Referenced by do_up().
|
static |
Definition at line 4067 of file init.c.
References context::c2, env_set_destroy(), context_2::es, and context_2::es_owned.
Referenced by close_instance().
|
static |
Definition at line 3965 of file init.c.
References BASE_N_EVENTS, context::c2, EVENT_METHOD_FAST, EVENT_METHOD_US_TIMEOUT, context_2::event_set, event_set_init(), context_2::event_set_max, and context_2::event_set_owned.
Referenced by inherit_context_top(), and init_instance().
bool do_genkey | ( | const struct options * | options | ) |
Definition at line 1012 of file init.c.
References auth_token_write_server_key_file(), D_GENKEY, options::genkey, GENKEY_AUTH_TOKEN, options::genkey_extra_data, options::genkey_filename, GENKEY_SECRET, GENKEY_TLS_CRYPTV2_CLIENT, GENKEY_TLS_CRYPTV2_SERVER, options::genkey_type, M_FATAL, M_NOPREFIX, M_USAGE, M_WARN, options::mlock, msg, platform_mlockall(), options::shared_secret_file, options::tls_crypt_v2_file, options::tls_crypt_v2_file_inline, tls_crypt_v2_write_client_key_file(), tls_crypt_v2_write_server_key_file(), and write_key_file().
Referenced by openvpn_main().
|
static |
Definition at line 2730 of file init.c.
References management_hold().
Referenced by do_startup_pause(), open_management(), and socket_restart_pause().
Definition at line 4059 of file init.c.
References context::c2, env_set_create(), env_set_inherit(), context_2::es, and context_2::es_owned.
Referenced by init_instance().
Definition at line 4186 of file init.c.
References plugin_list_inherit(), context::plugins, and context::plugins_owned.
Referenced by inherit_context_child().
|
static |
Definition at line 3692 of file init.c.
References context_2::buffers, context_2::buffers_owned, context::c2, context_2::frame, and init_context_buffers().
Referenced by init_instance().
|
static |
Definition at line 3491 of file init.c.
References do_init_crypto_none(), do_init_crypto_static(), do_init_crypto_tls(), context::options, options::shared_secret_file, options::tls_client, and options::tls_server.
Referenced by init_instance().
|
static |
Definition at line 3474 of file init.c.
References ASSERT, context::c1, init_key_type(), key_schedule::key_type, context_1::ks, M_WARN, msg, context::options, and options::test_crypto.
Referenced by do_init_crypto().
|
static |
Definition at line 2992 of file init.c.
References ASSERT, options::authname, context::c1, context::c2, options::ciphername, CO_MUTE_REPLAY_WARNINGS, CO_PACKET_ID_LONG_FORM, context_2::crypto_options, crypto_read_openvpn_key(), crypto_options::flags, init_crypto_pre(), init_key_type(), crypto_options::key_ctx_bi, key_ctx_bi_defined(), options::key_direction, key_schedule::key_type, context_1::ks, M_INFO, msg, options::mute_replay_warnings, context::options, crypto_options::packet_id, packet_id_init(), packet_id_persist_load_obj(), context_1::pid_persist, crypto_options::pid_persist, options::replay_time, options::replay_window, options::shared_secret_file, options::shared_secret_file_inline, key_schedule::static_key, and options::test_crypto.
Referenced by do_init_crypto(), and test_crypto_thread().
|
static |
Definition at line 3216 of file init.c.
References ASSERT, tls_options::auth_token_call_auth, options::auth_token_call_auth, tls_options::auth_token_generate, options::auth_token_generate, key_schedule::auth_token_key, tls_options::auth_token_key, tls_options::auth_token_lifetime, options::auth_token_lifetime, tls_options::auth_token_renewal, options::auth_token_renewal, tls_options::auth_user_pass_file, options::auth_user_pass_file, tls_options::auth_user_pass_file_inline, options::auth_user_pass_file_inline, tls_options::auth_user_pass_verify_script, options::auth_user_pass_verify_script, tls_options::auth_user_pass_verify_script_via_file, options::auth_user_pass_verify_script_via_file, context::c1, context::c2, options::ccd_exclusive, options::ce, CF_INIT_TLS_AUTH_STANDALONE, CF_INIT_TLS_MULTI, key_type::cipher, cipher_kt_mode_ofb_cfb(), options::ciphername, CLEAR, options::client_config_dir, tls_options::client_config_dir_exclusive, tls_options::client_crresponse_script, options::client_crresponse_script, CO_FORCE_TLSCRYPTV2_COOKIE, CO_MUTE_REPLAY_WARNINGS, CO_PACKET_ID_LONG_FORM, options::comp, tls_options::config_ciphername, tls_options::config_ncp_ciphers, tls_options::crl_file, options::crl_file, tls_options::crl_file_inline, options::crl_file_inline, tls_options::crypto_flags, tuntap::dco, tls_multi::dco, tls_options::dco_enabled, dco_enabled(), do_init_crypto_tls_c1(), tls_options::ekm_label, tls_options::ekm_label_size, tls_options::ekm_size, tls_options::es, context_2::es, tls_options::export_peer_cert_dir, crypto_options::flags, context_2::gc, get_random(), tls_options::gremlin, tls_options::handshake_window, options::handshake_window, init_crypto_pre(), IS_SIG, crypto_options::key_ctx_bi, key_schedule::key_type, tls_options::key_type, context_1::ks, link_socket_proto_connection_oriented(), max_int(), tls_options::mda_context, context_2::mda_context, options::mode, tls_wrap_ctx::mode, tls_options::mode, MODE_SERVER, options::mute_replay_warnings, options::ncp_ciphers, tls_options::net_ctx, context::net_ctx, tls_options::ns_cert_type, options::ns_cert_type, tls_wrap_ctx::opt, context::options, key_schedule::original_wrap_keydata, tls_wrap_ctx::original_wrap_keydata, tls_options::packet_timeout, context_1::pid_persist, crypto_options::pid_persist, tls_options::plugins, context::plugins, connection_entry::proto, PROTO_TCP_SERVER, tls_options::pull, options::pull, options::push_peer_info, tls_options::push_peer_info_detail, tls_options::remote_cert_eku, options::remote_cert_eku, tls_options::remote_cert_ku, options::remote_cert_ku, tls_options::renegotiate_bytes, options::renegotiate_bytes, tls_options::renegotiate_packets, options::renegotiate_packets, tls_options::renegotiate_seconds, options::renegotiate_seconds, options::renegotiate_seconds_min, tls_options::replay_time, options::replay_time, tls_options::replay_window, options::replay_window, options::sc_info, tls_options::sci, tls_options::server, context_2::session_id_hmac, session_id_hmac_init(), tls_options::single_session, options::single_session, key_schedule::ssl_ctx, tls_options::ssl_ctx, tls_options::ssl_flags, options::ssl_flags, tls_options::tcp_mode, options::test_crypto, connection_entry::tls_auth_file, context_2::tls_auth_standalone, tls_auth_standalone_init(), options::tls_client, connection_entry::tls_crypt_file, tls_options::tls_crypt_v2, connection_entry::tls_crypt_v2_file, connection_entry::tls_crypt_v2_force_cookie, key_schedule::tls_crypt_v2_server_key, tls_wrap_ctx::tls_crypt_v2_server_key, tls_options::tls_crypt_v2_verify_script, options::tls_crypt_v2_verify_script, key_schedule::tls_crypt_v2_wkc, tls_wrap_ctx::tls_crypt_v2_wkc, options::tls_export_peer_cert_dir, context_2::tls_multi, tls_multi_init(), options::tls_server, options::tls_timeout, options::tls_verify, tls_options::tls_wrap, key_schedule::tls_wrap_key, tls_options::tmp_dir, options::tmp_dir, tls_options::transition_window, options::transition_window, context_1::tuntap, tls_options::verify_command, tls_options::verify_hash, options::verify_hash, tls_options::verify_hash_algo, options::verify_hash_algo, tls_options::verify_hash_depth, options::verify_hash_depth, tls_options::verify_hash_no_ca, options::verify_hash_no_ca, tls_options::verify_x509_name, options::verify_x509_name, tls_options::verify_x509_type, options::verify_x509_type, tls_options::x509_track, options::x509_track, tls_options::x509_username_field, X509_USERNAME_FIELD_DEFAULT, and tls_options::xmit_hold.
Referenced by do_init_crypto().
|
static |
Definition at line 3119 of file init.c.
References AR_INTERACT, AR_NOINTERACT, AR_NONE, ASSERT, auth_retry_get(), options::auth_token_generate, auth_token_init_secret(), key_schedule::auth_token_key, options::auth_token_secret_file, options::auth_token_secret_file_inline, options::authname, context::c0, context::c1, options::ciphername, D_INIT_MEDIUM, do_init_tls_wrap_key(), options::enable_ncp_fallback, init_key_type(), init_ssl(), key_schedule::key_type, context_1::ks, M_FATAL, msg, options::ncp_ciphers, context::options, options::priv_key_file_inline, register_signal(), context::sig, key_schedule::ssl_ctx, ssl_purge_auth(), streq, string_clear(), tls_ctx_initialised(), tls_item_in_cipher_list(), and context_0::uid_gid_chroot_set.
Referenced by do_init_crypto_tls().
|
static |
Definition at line 3786 of file init.c.
References ALLOC_OBJ_CLEAR_GC, context::c0, options::cd_dir, context::did_we_daemonize, context::first_time, context::gc, options::groupname, options::nice, context::options, platform_chdir(), platform_group_get(), platform_nice(), context_0::platform_state_group, context_0::platform_state_user, platform_user_get(), context_0::uid_gid_specified, and options::username.
Referenced by init_instance().
|
static |
Definition at line 3704 of file init.c.
References ASSERT, context::c1, context::c2, options::ce, connection_entry::fragment, context_2::fragment, fragment_frame_init(), context_2::frame, frame_calculate_dynamic(), context_2::frame_fragment, get_link_socket_info(), key_schedule::key_type, context_1::ks, and context::options.
Referenced by init_instance().
|
static |
Definition at line 3508 of file init.c.
References context::c2, options::ce, frame::extra_tun, connection_entry::fragment, connection_entry::fragment_encap, context_2::frame, frame_finalize_options(), M_WARN, msg, connection_entry::mssfix, connection_entry::mssfix_encap, options::mtu_test, context::options, connection_entry::tun_mtu_extra, and connection_entry::tun_mtu_extra_defined.
Referenced by init_instance().
|
static |
Definition at line 3446 of file init.c.
References alloc_buf_gc(), ASSERT, frame::buf, BUF_SIZE, context::c2, options::ce, D_MTU_INFO, context_2::frame, tls_auth_standalone::frame, tls_options::frame, frame_print(), context_2::gc, tls_multi::opt, context::options, frame::payload_size, context_2::tls_auth_standalone, tls_init_control_channel_frame_parameters(), connection_entry::tls_mtu, context_2::tls_multi, tls_multi_init_finalize(), tls_auth_standalone::tls_wrap, frame::tun_max_mtu, tls_wrap_ctx::work, and tls_auth_standalone::workbuf.
Referenced by init_instance().
|
static |
Definition at line 1512 of file init.c.
References add_route_ipv6_to_option_list(), DCO_DEFAULT_METRIC, dco_enabled(), es, route_ipv6_option_list::flags, route_ipv6_option_list::gc, options::ifconfig_ipv6_remote, init_route_ipv6_list(), link_socket_current_remote_ipv6(), RG_REROUTE_GW, options::route_default_metric, options::route_ipv6_default_gateway, options::routes_ipv6, setenv_routes_ipv6(), and string_alloc().
Referenced by do_open_tun().
|
static |
Definition at line 1466 of file init.c.
References DCO_DEFAULT_METRIC, dco_enabled(), options::dev, options::dev_type, dev_type_enum(), DEV_TYPE_TUN, es, options::ifconfig_remote_netmask, init_route_list(), link_socket_current_remote(), options::route_default_gateway, options::route_default_metric, options::routes, setenv_routes(), TOP_NET30, TOP_P2P, and options::topology.
Referenced by do_open_tun().
|
static |
Definition at line 1334 of file init.c.
References context::c2, options::ce, connection_entry::connect_timeout, event_timeout_init(), now, context::options, context_2::server_poll_interval, and update_time().
Referenced by init_instance().
|
static |
Definition at line 1347 of file init.c.
References options::auth_token_generate, options::auth_token_renewal, context_2::auth_token_renewal_interval, context::c2, dco_enabled(), event_timeout_clear(), event_timeout_init(), context_2::inactivity_interval, options::inactivity_timeout, interval_init(), options::mtu_test, now, options::occ, context_2::occ_interval, OCC_INTERVAL_SECONDS, OCC_MTU_LOAD_INTERVAL_SECONDS, context_2::occ_mtu_load_test_interval, context::options, context_2::options_string_local, context_2::options_string_remote, options::packet_id_file, context_2::packet_id_persist_interval, context_2::ping_rec_interval, options::ping_rec_timeout, context_2::ping_send_interval, options::ping_send_timeout, options::renegotiate_seconds, reset_coarse_timers(), context_2::session_interval, options::session_timeout, TLS_MODE, TLS_MULTI_HORIZON, TLS_MULTI_REFRESH, context_2::tmp_int, update_time(), and context_2::wait_for_connect.
Referenced by do_deferred_options(), and init_instance().
|
static |
Definition at line 3041 of file init.c.
References options::authname, buf_len(), context::c1, options::ce, key_type::cipher, CLEAR, crypto_read_openvpn_key(), key_type::digest, connection_entry::key_direction, context_1::ks, M_FATAL, M_WARN, md_valid(), msg, context::options, key_schedule::original_wrap_keydata, connection_entry::tls_auth_file, connection_entry::tls_auth_file_inline, key_schedule::tls_auth_key_type, tls_crypt_buf_overhead(), connection_entry::tls_crypt_file, connection_entry::tls_crypt_file_inline, tls_crypt_init_key(), connection_entry::tls_crypt_v2_file, connection_entry::tls_crypt_v2_file_inline, tls_crypt_v2_init_client_key(), tls_crypt_v2_init_server_key(), key_schedule::tls_crypt_v2_server_key, key_schedule::tls_crypt_v2_wkc, connection_entry::tls_mtu, options::tls_server, and key_schedule::tls_wrap_key.
Referenced by do_init_crypto_tls_c1().
|
static |
Definition at line 1432 of file init.c.
References context::c2, context::options, context_2::shaper, options::shaper, shaper_init(), and shaper_msg().
Referenced by do_deferred_options(), and init_instance().
|
static |
Definition at line 1744 of file init.c.
References link_socket_addr::bind_local, context::c1, context::c2, options::dev, options::dev_type, context_2::es, context_2::frame, options::ifconfig_ipv6_local, options::ifconfig_ipv6_netbits, options::ifconfig_ipv6_remote, options::ifconfig_local, options::ifconfig_nowarn, options::ifconfig_remote_netmask, init_tun(), init_tun_post(), context_1::link_socket_addr, context::net_ctx, context::options, link_socket_addr::remote_list, options::topology, context_1::tuntap, options::tuntap_options, context_1::tuntap_owned, tuntap::windows_driver, and options::windows_driver.
Referenced by do_open_tun().
|
static |
Definition at line 3725 of file init.c.
References ASSERT, context::c2, context_2::link_socket, link_socket_new(), and context_2::link_socket_owned.
Referenced by init_instance().
|
static |
Definition at line 4030 of file init.c.
References context::c1, context_1::ifconfig_pool_persist, options::ifconfig_pool_persist_filename, ifconfig_pool_persist_init(), context_1::ifconfig_pool_persist_owned, options::ifconfig_pool_persist_refresh_freq, and context::options.
Referenced by init_instance().
|
static |
Definition at line 3999 of file init.c.
References context::c1, context::options, options::status_file, options::status_file_update_freq, status_open(), context_1::status_output, context_1::status_output_owned, and STATUS_OUTPUT_WRITE.
Referenced by init_instance().
|
static |
Definition at line 1836 of file init.c.
References tuntap::actual_name, tuntap::adapter_index, add_wfp_block(), ASSERT, context::c1, context::c2, can_preserve_tun(), D_ROUTE, tuntap::dco, tls_multi::dco, dco_enabled(), options::dev, options::dev_node, options::dev_type, dev_type_string(), do_alloc_route_list(), do_ifconfig(), do_ifconfig_setenv(), do_init_route_ipv6_list(), do_init_route_list(), do_init_tun(), do_route(), context_2::es, context_2::frame, gc_free(), gc_new(), guess_tuntap_dev(), IA_EMPTY_IF_UNDEF, IFCONFIG_AFTER_TUN_OPEN, IFCONFIG_BEFORE_TUN_OPEN, options::ifconfig_noexec, ifconfig_order(), link_socket::info, ISC_ROUTE_ERRORS, context_2::link_socket, options::lladdr, tuntap::local, M_INFO, context::mode, msg, tuntap_options::msg_channel, options::msg_channel, context::net_ctx, open_tun(), OPENVPN_PLUGIN_UP, tuntap::options, context::options, ovpn_dco_init(), context::plugins, print_in_addr_t(), tuntap::remote_netmask, ROUTE_AFTER_TUN, ROUTE_BEFORE_TUN, options::route_delay_defined, context_1::route_ipv6_list, context_1::route_list, route_order(), options::routes, options::routes_ipv6, run_up_down(), set_lladdr(), static_context, status, context_2::tls_multi, frame::tun_mtu, context_1::tuntap, context_1::tuntap_owned, options::up_restart, and options::up_script.
Referenced by do_up(), and init_instance().
|
static |
Definition at line 3553 of file init.c.
References options::chroot_dir, options::client_config_dir, options::duplicate_cn, context::first_time, options::groupname, options::ifconfig_local, options::ifconfig_pool_persist_filename, options::keepalive_ping, options::keepalive_timeout, M_WARN, options::mode, MODE_SERVER, msg, context::net_ctx, NS_CERT_CHECK_SERVER, options::ns_cert_type, context::options, PACKAGE_NAME, options::persist_tun, options::ping_rec_timeout, options::ping_send_timeout, options::pull, options::remote_cert_eku, script_security(), options::server_bridge_defined, options::server_bridge_proxy_dhcp, SSEC_PW_ENV, SSEC_SCRIPTS, options::tls_client, options::tls_server, options::tls_verify, options::user_script_used, options::username, options::verify_hash, options::verify_hash_depth, VERIFY_X509_NONE, options::verify_x509_type, and warn_on_use_of_common_subnets().
Referenced by init_instance().
bool do_persist_tuntap | ( | struct options * | options, |
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 1095 of file init.c.
References options::ce, dco_enabled(), options::dev, options::dev_node, options::dev_type, dev_type_enum(), DEV_TYPE_TUN, tuntap_options::disable_dco, options::groupname, options::ifconfig_local, options::ifconfig_remote_netmask, options::lladdr, M_FATAL, M_OPTERR, M_WARN, msg, notnull(), options::persist_config, options::persist_mode, connection_entry::remote, set_lladdr(), options::shared_secret_file, options::tls_client, options::tls_server, tuncfg(), options::tuntap_options, and options::username.
Referenced by openvpn_main().
|
static |
Definition at line 3736 of file init.c.
References context::c2, D_MTU_INFO, context_2::fragment, context_2::frame, context_2::frame_fragment, and frame_print().
Referenced by init_instance().
bool do_route | ( | const struct options * | options, |
struct route_list * | route_list, | ||
struct route_ipv6_list * | route_ipv6_list, | ||
const struct tuntap * | tt, | ||
const struct plugin_list * | plugins, | ||
struct env_set * | es, | ||
openvpn_net_ctx_t * | ctx | ||
) |
Definition at line 1686 of file init.c.
References add_routes(), argv_free(), argv_new(), argv_parse_cmd(), check_debug_level(), D_SHOW_NET, es, M_INFO, M_NOPREFIX, M_WARN, management_up_down(), msg, OPENVPN_PLUGIN_FUNC_SUCCESS, OPENVPN_PLUGIN_ROUTE_UP, openvpn_run_script(), plugin_call(), plugin_defined(), route_did_redirect_default_gateway(), options::route_noexec, ROUTE_OPTION_FLAGS, options::route_script, setenv_int(), setenv_str(), show_adapters(), options::show_net_up, and show_routes().
Referenced by check_add_routes_action(), and do_open_tun().
|
static |
Definition at line 4086 of file init.c.
References context::c2, options::ce, options::fast_io, context_2::fast_io, M_INFO, msg, context::options, connection_entry::proto, proto_is_udp(), and options::shaper.
Referenced by init_instance().
|
static |
Definition at line 4113 of file init.c.
References context::c2, context::options, options::tls_exit, and context_2::tls_exit_signal.
Referenced by init_instance().
|
static |
Definition at line 2827 of file init.c.
References do_hold(), context::first_time, and socket_restart_pause().
Referenced by init_instance().
bool do_test_crypto | ( | const struct options * | o | ) |
Definition at line 5013 of file init.c.
References context_clear(), context::first_time, M_INFO, msg, context::options, options_detach(), options::test_crypto, test_crypto_thread(), and title_string.
Referenced by openvpn_main().
|
static |
Definition at line 1200 of file init.c.
References context::c0, options::chroot_dir, context::first_time, M_ERR, M_INFO, msg, context::options, platform_chroot(), context_0::platform_state_group, context_0::platform_state_user, platform_user_group_set(), context_0::uid_gid_chroot_set, and context_0::uid_gid_specified.
Referenced by init_instance(), and initialization_sequence_completed().
bool do_up | ( | struct context * | c, |
bool | pulled_options, | ||
unsigned int | option_types_found | ||
) |
Definition at line 2372 of file init.c.
References context::c1, context::c2, CAS_CONNECT_DONE, CAS_RECONNECT_PENDING, D_DCO, D_PUSH_ERRORS, D_TLS_ERRORS, dco_p2p_add_new_peer(), context_2::did_open_tun, do_close_tun(), do_deferred_options(), do_deferred_options_part2(), do_deferred_p2p_ncp(), do_open_tun(), context_2::do_up_ran, event_timeout_init(), initialization_sequence_completed(), context_2::link_socket, M_INFO, M_NONFATAL, management_sleep(), options::mode, context::mode, MODE_POINT_TO_POINT, msg, tls_multi::multi_state, now, context::options, options_hash_changed_or_zero(), p2p_set_dco_keepalive(), PULL_DEFINED, context_2::pulled_options_digest, context_1::pulled_options_digest_save, reset_coarse_timers(), ROUTE_AFTER_TUN, options::route_delay, options::route_delay_defined, options::route_delay_window, route_order(), context_2::route_wakeup, context_2::route_wakeup_expire, link_socket::sd, SOCKET_UNDEFINED, context_2::tls_multi, tls_print_deferred_options_results(), tun_standby_init(), context_1::tuntap, tuntap_is_dco_win(), options::up_delay, and update_time().
Referenced by check_connection_established(), and incoming_push_message().
Definition at line 1284 of file init.c.
References alloc_buf_gc(), BSTR, buf_printf(), context::c2, tls_common_name(), and context_2::tls_multi.
Referenced by trigger_ping_timeout_signal().
Definition at line 2872 of file init.c.
References frame::buf, context::c2, options::ce, crypto_max_overhead(), D_MTU_DEBUG, context_2::frame, get_frame_mtu(), frame::headroom, max_int(), msg, context::options, frame::payload_size, frame::tailroom, connection_entry::tls_mtu, frame::tun_max_mtu, frame::tun_mtu, connection_entry::tun_mtu_defined, connection_entry::tun_mtu_extra, and connection_entry::tun_mtu_max.
Referenced by do_init_frame(), and test_crypto_thread().
void free_context_buffers | ( | struct context_buffers * | b | ) |
Definition at line 3667 of file init.c.
References context_buffers::aux_buf, context_buffers::decrypt_buf, context_buffers::encrypt_buf, free_buf(), context_buffers::read_link_buf, and context_buffers::read_tun_buf.
Referenced by do_close_free_buf(), and multi_top_free().
Definition at line 2840 of file init.c.
References ASSERT, context::c1, context::c2, options::ce, context_2::frame, frame_calculate_protocol_header_size(), frame_print(), key_schedule::key_type, context_1::ks, connection_entry::link_mtu, connection_entry::link_mtu_defined, M_FATAL, M_WARN, msg, connection_entry::tun_mtu, connection_entry::tun_mtu_defined, and TUN_MTU_MIN.
Referenced by frame_finalize_options().
Definition at line 4786 of file init.c.
References context_2::accept_from, ALLOC_OBJ_CLEAR_GC, ALLOC_OBJ_GC, key_schedule::auth_token_key, options::authname, context_2::buffers, context::c1, context::c2, CC_NO_CLOSE, CC_USR1_TO_HUP, options::ce, options::ciphername, CLEAR, CM_CHILD_TCP, CM_CHILD_UDP, link_socket_info::connection_established, do_inherit_plugins(), context_2::es, context::gc, gc_new(), link_socket::info, init_instance(), IS_SIG, key_schedule::key_type, context_1::ks, context_2::link_socket, context_1::link_socket_addr, context_2::link_socket_info, link_socket_info::lsa, context::mode, context::options, options_detach(), packet_id_persist_init(), context_1::pid_persist, connection_entry::proto, proto_is_dgram(), context::sig, key_schedule::ssl_ctx, key_schedule::tls_auth_key_type, key_schedule::tls_crypt_v2_server_key, key_schedule::tls_wrap_key, and context_1::tuntap.
Referenced by multi_create_instance().
Definition at line 4864 of file init.c.
References context_2::buffers_owned, context::c0, context::c1, context::c2, options::ce, CM_TOP_CLONE, do_event_set_init(), context_2::es_owned, context_2::event_set, context_2::event_set_owned, context::first_time, context_2::gc, context::gc, gc_detach(), context_1::ifconfig_pool_persist_owned, context_2::link_socket_owned, context::mode, context::options, options_detach(), context::plugins_owned, connection_entry::proto, proto_is_dgram(), context_1::status_output_owned, context_2::tls_multi, and context_1::tuntap_owned.
Referenced by multi_top_init().
|
static |
Definition at line 472 of file init.c.
References connection_list::array, options::connection_list, connection_list::current, get_random(), connection_list::len, context::options, and options::remote_random.
Referenced by context_init_1().
struct context_buffers* init_context_buffers | ( | const struct frame * | frame | ) |
Definition at line 3642 of file init.c.
References alloc_buf(), ALLOC_OBJ_CLEAR, context_buffers::aux_buf, BUF_SIZE, context_buffers::decrypt_buf, context_buffers::encrypt_buf, context_buffers::read_link_buf, and context_buffers::read_tun_buf.
Referenced by do_init_buffers(), and multi_top_init().
|
static |
Definition at line 2964 of file init.c.
References context::c1, CF_LOAD_PERSISTED_PACKET_ID, crypto_init_lib_engine(), options::engine, context::options, options::packet_id_file, packet_id_persist_load(), and context_1::pid_persist.
Referenced by do_init_crypto_static(), and do_init_crypto_tls().
Definition at line 4406 of file init.c.
References AR_INTERACT, auth_retry_get(), context::c1, context::c2, options::ce, CF_INIT_TLS_AUTH_STANDALONE, CF_INIT_TLS_MULTI, CF_LOAD_PERSISTED_PACKET_ID, close_context(), CM_CHILD_TCP, CM_CHILD_UDP, CM_P2P, CM_TOP, options::comp, context_2::did_open_tun, do_compute_occ_strings(), do_event_set_init(), do_inherit_env(), do_init_buffers(), do_init_crypto(), do_init_first_time(), do_init_fragment(), do_init_frame(), do_init_frame_tls(), do_init_server_poll_timeout(), do_init_timers(), do_init_traffic_shaper(), do_link_socket_new(), do_open_ifconfig_pool_persist(), do_open_status_output(), do_open_tun(), do_option_warnings(), do_preresolve(), do_print_data_channel_mtu_parms(), do_setup_fast_io(), do_signal_on_tls_errors(), do_startup_pause(), do_uid_gid_chroot(), context::first_time, connection_entry::fragment, context_2::fragment, fragment_init(), context_2::frame, frame_calculate_dynamic(), context_2::gc, gc_init(), get_link_socket_info(), init_management_callback_p2p(), init_proxy(), init_query_passwords(), init_verb_mute(), IS_SIG, IVM_LEVEL_2, key_schedule::key_type, context_1::ks, link_socket_init_phase1(), link_socket_init_phase2(), LS_MODE_DEFAULT, LS_MODE_TCP_ACCEPT_FROM, LS_MODE_TCP_LISTEN, options::mlock, context::mode, next_connection_entry(), context_2::occ_op, occ_reset_op(), open_plugins(), OPENVPN_PLUGIN_INIT_POST_DAEMON, OPENVPN_PLUGIN_INIT_POST_UID_CHANGE, OPENVPN_PLUGIN_INIT_PRE_DAEMON, context::options, P2P_ERROR_DELAY_MS, platform_mlockall(), pre_connect_restore(), connection_entry::proto, PROTO_TCP_SERVER, PULL_DEFINED, options::resolve_in_advance, set_check_status_error_delay(), SHAPER_DEFINED, context::sig, signal_info::signal_text, and options::up_delay.
Referenced by inherit_context_child(), and init_instance_handle_signals().
void init_instance_handle_signals | ( | struct context * | c, |
const struct env_set * | env, | ||
const unsigned int | flags | ||
) |
Definition at line 4384 of file init.c.
References management_callback::flags, init_instance(), IS_SIG, post_init_signal_catch(), pre_init_signal_catch(), remap_signal(), and uninit_management_callback().
Referenced by tunnel_point_to_point(), tunnel_server_tcp(), and tunnel_server_udp().
void init_management | ( | void | ) |
void init_management_callback_p2p | ( | struct context * | c | ) |
Definition at line 4260 of file init.c.
References management_callback::arg, CLEAR, management_callback_proxy_cmd(), management_callback_remote_cmd(), management_callback_remote_entry_count(), management_callback_remote_entry_get(), management_callback_send_cc_message(), management_callback_status_p2p(), management_set_callback(), management_show_net_callback(), management_callback::proxy_cmd, management_callback::remote_cmd, management_callback::remote_entry_count, management_callback::remote_entry_get, management_callback::send_cc_message, management_callback::show_net, and management_callback::status.
Referenced by init_instance().
void init_options_dev | ( | struct options * | options | ) |
Definition at line 963 of file init.c.
References basename(), options::dev, options::dev_node, and string_alloc().
Referenced by openvpn_main().
void init_plugins | ( | struct context * | c | ) |
Definition at line 4128 of file init.c.
References context::options, options::plugin_list, plugin_list_init(), context::plugins, and context::plugins_owned.
Referenced by openvpn_main().
|
static |
Definition at line 718 of file init.c.
References init_proxy_dowork().
Referenced by init_instance().
|
static |
Definition at line 686 of file init.c.
References context::c1, options::ce, http_proxy_options::first_time, context::first_time, context_1::http_proxy, http_proxy_new(), connection_entry::http_proxy_options, context_1::http_proxy_owned, context::options, context_1::socks_proxy, connection_entry::socks_proxy_authfile, socks_proxy_new(), context_1::socks_proxy_owned, connection_entry::socks_proxy_port, connection_entry::socks_proxy_server, and uninit_proxy_dowork().
Referenced by init_proxy().
void init_query_passwords | ( | const struct context * | c | ) |
Query for private key and auth-user-pass username/passwords.
Definition at line 641 of file init.c.
References options::auth_user_pass_file, options::auth_user_pass_file_inline, auth_user_pass_setup(), enable_auth_user_pass(), options::key_pass_file, context::options, pem_password_setup(), and options::sc_info.
Referenced by init_instance(), and openvpn_main().
bool init_static | ( | void | ) |
Definition at line 816 of file init.c.
References error_reset(), gc_free(), gc_new(), init_ssl_lib(), init_win32(), M_INFO, M_WARN, msg, platform_create_temp_file(), reset_check_status(), sleep, srandom, status_close(), status_open(), STATUS_OUTPUT_WRITE, status_printf(), time_test(), and update_time().
Referenced by openvpn_main().
void init_verb_mute | ( | struct context * | c, |
unsigned int | flags | ||
) |
Definition at line 940 of file init.c.
References context::c2, check_debug_level(), D_LINK_ERRORS, D_LOG_RW, D_READ_WRITE, status_output::flags, IVM_LEVEL_1, IVM_LEVEL_2, context_2::log_rw, options::mute, context::options, SDL_CONSTRAIN, set_check_status(), set_debug_level(), set_mute_cutoff(), and options::verbosity.
Referenced by do_deferred_options(), init_early(), init_instance(), openvpn_main(), and test_crypto_thread().
void initialization_sequence_completed | ( | struct context * | c, |
const unsigned int | flags | ||
) |
Definition at line 1571 of file init.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, addr_defined(), context::c1, context::c2, CLEAR, link_socket_actual::dest, do_uid_gid_chroot(), fork_register_dns_action(), get_link_socket_info(), openvpn_sockaddr::in4, openvpn_sockaddr::in6, ISC_ERRORS, ISC_ROUTE_ERRORS, ISC_SERVER, context_2::link_socket, tuntap::local, tuntap::local_ipv6, link_socket_info::lsa, M_INFO, M_NOPREFIX, management_post_tunnel_open(), management_set_state(), msg, options::no_advance, OPENVPN_STATE_CONNECTED, context::options, openvpn_sockaddr::sa, link_socket::sd, show_adapters(), show_routes(), context_1::tuntap, and options::unsuccessful_attempts.
Referenced by check_add_routes_action(), do_up(), tunnel_server_tcp(), and tunnel_server_udp().
|
static |
Definition at line 2952 of file init.c.
References key_schedule::auth_token_key, CLEAR, free_key_ctx(), free_key_ctx_bi(), key_schedule::ssl_ctx, key_schedule::static_key, tls_ctx_free(), and tls_ctx_initialised().
Referenced by do_close_free_key_schedule(), and test_crypto_thread().
|
static |
Definition at line 210 of file init.c.
References http_proxy_options::auth_retry, context::c2, options::ce, CE_MAN_QUERY_PROXY, connection_entry::flags, context_2::gc, connection_entry::http_proxy_options, init_http_proxy_options_once(), M_WARN, msg, context::options, PAR_ALL, PAR_NCT, http_proxy_options::port, connection_entry::proto, PROTO_TCP, PROTO_TCP_CLIENT, http_proxy_options::server, connection_entry::socks_proxy_port, connection_entry::socks_proxy_server, streq, string_alloc(), and update_time().
Referenced by init_management_callback_p2p().
|
static |
Definition at line 375 of file init.c.
References ALLOC_OBJ_CLEAR_GC, options::ce, options::ce_advance_count, CE_MAN_QUERY_REMOTE_ACCEPT, CE_MAN_QUERY_REMOTE_MASK, CE_MAN_QUERY_REMOTE_MOD, CE_MAN_QUERY_REMOTE_QUERY, CE_MAN_QUERY_REMOTE_SHIFT, CE_MAN_QUERY_REMOTE_SKIP, connection_entry::flags, options::gc, remote_host_store::host, context::options, remote_host_store::port, connection_entry::remote, connection_entry::remote_port, RH_HOST_LEN, RH_PORT_LEN, options::rh_store, and strncpynt().
Referenced by init_management_callback_p2p().
|
static |
Definition at line 331 of file init.c.
References options::connection_list, connection_list::len, and context::options.
Referenced by init_management_callback_p2p().
|
static |
Definition at line 341 of file init.c.
References connection_entry::af, connection_list::array, CE_DISABLED, check_malloc_return(), options::connection_list, connection_entry::flags, connection_list::len, M_WARN, msg, context::options, connection_entry::proto, proto2ascii(), connection_entry::remote, connection_entry::remote_port, and status.
Referenced by init_management_callback_p2p().
|
static |
This method sends a custom control channel message.
This will write the control message
command parm1,parm2,..to the control channel.
arg | The context struct |
command | The command being sent |
parameters | the parameters to the command |
Definition at line 306 of file init.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), D_PUSH, gc_free(), gc_new(), buffer::len, PUSH_BUNDLE_SIZE, send_control_channel_string(), and status.
Referenced by init_management_callback_p2p().
|
static |
Definition at line 4200 of file init.c.
References print_status().
Referenced by init_management_callback_p2p().
void management_show_net_callback | ( | void * | arg, |
const int | msglevel | ||
) |
Definition at line 4207 of file init.c.
References msg, show_adapters(), and show_routes().
Referenced by init_management_callback_multi(), and init_management_callback_p2p().
|
static |
Definition at line 512 of file init.c.
References options::advance_next_remote, connection_list::array, ASSERT, context::c1, options::ce, options::ce_advance_count, CE_DISABLED, ce_management_query_proxy(), ce_management_query_remote(), clear_remote_addrlist(), options::connect_retry_max, options::connection_list, connection_list::current, link_socket_addr::current_remote, connection_entry::flags, IS_SIG, connection_list::len, context_1::link_socket_addr, M_FATAL, management_query_proxy_enabled(), management_query_remote_enabled(), msg, options::no_advance, context::options, options::persist_remote_ip, link_socket_addr::remote_list, options::resolve_in_advance, options::unsuccessful_attempts, and update_options_ce_post().
Referenced by init_instance(), and test_crypto_thread().
bool open_management | ( | struct context * | c | ) |
Definition at line 4295 of file init.c.
References close_management(), do_hold(), management_callback::flags, IS_SIG, M_WARN, options::management_addr, options::management_client_group, options::management_client_user, options::management_echo_buffer_size, options::management_flags, options::management_log_history_cache, management_open(), options::management_port, management_set_state(), options::management_state_buffer_size, options::management_user_pass, MF_SERVER, options::mode, MODE_SERVER, msg, OPENVPN_STATE_CONNECTING, context::options, and options::remap_sigusr1.
Referenced by openvpn_main().
void open_plugins | ( | struct context * | c, |
const bool | import_options, | ||
int | init_point | ||
) |
Definition at line 4138 of file init.c.
References context::c2, D_IMPORT_ERRORS, context_2::es, context::es, plugin_return::list, M_OPTERR, plugin_return::n, OPT_P_DEFAULT, OPT_P_PLUGIN, context::options, options_string_import(), options::plugin_list, plugin_list_open(), plugin_return_defined(), plugin_return_free(), plugin_return_get_column(), plugin_return_init(), context::plugins, context::plugins_owned, and openvpn_plugin_string_list::value.
Referenced by init_instance(), and openvpn_main().
|
static |
|
static |
Definition at line 2182 of file init.c.
References context::c1, context::c2, D_DCO, tuntap::dco, dco_enabled(), tls_multi::dco_peer_id, dco_set_peer(), context_2::frame, msg, frame::mss_fix, context::options, options::ping_rec_timeout, options::ping_send_timeout, context_2::tls_multi, and context_1::tuntap.
Referenced by do_up().
void persist_client_stats | ( | struct context * | c | ) |
Definition at line 4369 of file init.c.
References man_persist_client_stats().
Referenced by tunnel_point_to_point().
bool possibly_become_daemon | ( | const struct options * | options | ) |
Definition at line 1158 of file init.c.
References daemon(), options::daemon, options::log, M_ERR, msg, restore_signal_state(), and set_std_files_to_null().
Referenced by openvpn_main().
void pre_setup | ( | const struct options * | options | ) |
Definition at line 1295 of file init.c.
References options::config, options::exit_event_initial_state, options::exit_event_name, win32_signal::mode, win32_signal_open(), window_title_generate(), window_title_save(), WSO_FORCE_CONSOLE, WSO_FORCE_SERVICE, and WSO_MODE_CONSOLE.
Referenced by openvpn_main().
bool print_openssl_info | ( | const struct options * | options | ) |
Definition at line 973 of file init.c.
References options::cipher_list, options::cipher_list_tls13, show_available_ciphers(), show_available_curves(), show_available_digests(), show_available_engines(), show_available_tls_ciphers(), options::show_ciphers, options::show_curves, options::show_digests, options::show_engines, options::show_tls_ciphers, and options::tls_cert_profile.
Referenced by openvpn_main().
unsigned int pull_permission_mask | ( | const struct context * | c | ) |
Definition at line 2516 of file init.c.
References OPT_P_COMP, OPT_P_DHCPDNS, OPT_P_ECHO, OPT_P_EXPLICIT_NOTIFY, OPT_P_MESSAGES, OPT_P_NCP, OPT_P_PEER_ID, OPT_P_PERSIST, OPT_P_PULL_MODE, OPT_P_PUSH_MTU, OPT_P_ROUTE, OPT_P_ROUTE_EXTRAS, OPT_P_SETENV, OPT_P_SHAPER, OPT_P_SOCKBUF, OPT_P_SOCKFLAGS, OPT_P_TIMER, OPT_P_UP, context::options, and options::route_nopull.
Referenced by incoming_push_message().
void remove_pid_file | ( | void | ) |
Definition at line 4976 of file init.c.
References platform_unlink(), and saved_pid_file_name.
Referenced by openvpn_exit().
void reset_coarse_timers | ( | struct context * | c | ) |
Definition at line 1323 of file init.c.
References context::c2, and context_2::coarse_timer_wakeup.
Referenced by check_connection_established(), check_tls(), do_init_timers(), do_up(), process_explicit_exit_notification_init(), and schedule_exit().
|
static |
Definition at line 108 of file init.c.
References argv_free(), argv_msg(), argv_new(), argv_parse_cmd(), argv_printf(), argv_printf_cat(), ASSERT, es, argv::gc, gc_free(), gc_new(), M_FATAL, M_INFO, msg, OPENVPN_PLUGIN_FUNC_SUCCESS, openvpn_run_script(), plugin_call(), plugin_defined(), S_FATAL, setenv_int(), and setenv_str().
Referenced by do_close_tun(), and do_open_tun().
|
static |
Definition at line 2749 of file init.c.
References AR_NOINTERACT, auth_retry_get(), options::ce, connection_entry::connect_retry_seconds, connection_entry::connect_retry_seconds_max, options::connection_list, D_RESTART, do_hold(), connection_list::len, management_sleep(), max_int(), min_int(), msg, context::options, context::persist, connection_entry::proto, PROTO_TCP_CLIENT, PROTO_TCP_SERVER, PROTO_UDP, context_persist::restart_sleep_seconds, options::server_backoff_time, options::tls_client, and options::unsuccessful_attempts.
Referenced by do_startup_pause().
|
static |
Definition at line 4990 of file init.c.
References ASSERT, context::c1, context::c2, context_gc_free(), context_init_1(), context_2::crypto_options, do_init_crypto_static(), context_2::frame, frame_finalize_options(), init_verb_mute(), IVM_LEVEL_1, key_schedule_free(), context_1::ks, next_connection_entry(), context::options, crypto_options::packet_id, packet_id_free(), options::test_crypto, and test_crypto().
Referenced by do_test_crypto().
|
static |
Prints the results of options imported for the data channel.
o |
Definition at line 2222 of file init.c.
References add_delim_if_non_empty(), options::authname, BSTR, buf_clear(), buf_len(), buf_printf(), buf_set_write(), context::c2, options::ce, cipher_kt_mode_aead(), cipher_kt_name(), options::ciphername, CO_USE_CC_EXIT_NOTIFY, CO_USE_DYNAMIC_TLS_CRYPT, CO_USE_TLS_KEY_MATERIAL_EXPORT, D_HANDSHAKE, connection_entry::explicit_exit_notification, options::imported_protocol_flags, options::inactivity_minimum_bytes, options::inactivity_timeout, md_kt_name(), msg, context::options, options::peer_id, PING_EXIT, options::ping_rec_timeout, options::ping_rec_timeout_action, options::ping_send_timeout, PING_UNDEF, options::session_timeout, and options::use_peer_id.
Referenced by do_up().
void tun_abort | ( | void | ) |
Definition at line 2154 of file init.c.
References do_close_tun(), and static_context.
Referenced by openvpn_exit().
void uninit_management_callback | ( | void | ) |
Definition at line 4358 of file init.c.
References management_clear_callback().
Referenced by init_instance_handle_signals(), tunnel_point_to_point(), tunnel_server_tcp(), and tunnel_server_udp().
|
static |
Definition at line 724 of file init.c.
References uninit_proxy_dowork().
Referenced by close_instance().
|
static |
Definition at line 669 of file init.c.
References context::c1, context_1::http_proxy, http_proxy_close(), context_1::http_proxy_owned, context_1::socks_proxy, socks_proxy_close(), and context_1::socks_proxy_owned.
Referenced by init_proxy_dowork(), and uninit_proxy().
void uninit_static | ( | void | ) |
|
static |
Definition at line 191 of file init.c.
References options::ce, options::ping_rec_timeout, options::ping_rec_timeout_action, PING_RESTART, PING_UNDEF, PRE_PULL_INITIAL_PING_RESTART, connection_entry::proto, proto_is_dgram(), and options::pull.
Referenced by next_connection_entry().
void write_pid_file | ( | const char * | filename, |
const char * | chroot_dir | ||
) |
Definition at line 4946 of file init.c.
References options::chroot_dir, M_ERR, msg, platform_fopen(), platform_getpid(), and saved_pid_file_name.
Referenced by openvpn_main().
|
static |
Definition at line 62 of file init.c.
Referenced by remove_pid_file(), and write_pid_file().
|
static |
Definition at line 61 of file init.c.
Referenced by do_close_tun(), do_open_tun(), and tun_abort().