OpenVPN
Macros | Functions | Variables
init.c File Reference
#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 "memdbg.h"
Include dependency graph for init.c:

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)
 
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, int link_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 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)
 
static void save_ncp_options (struct context *c)
 
static void restore_ncp_options (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 (const 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)
 
void 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 do_open_tun (struct context *c)
 
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...
 
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 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_auth_token_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_finalize_tls_frame (struct context *c)
 
static void do_init_crypto_none (const 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)
 
static void do_init_frame_tls (struct context *c)
 
struct context_buffersinit_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_init_socket_1 (struct context *c, const int mode)
 
static void do_init_socket_2 (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_check_if_restart_permitted (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 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 contextstatic_context
 
static const char * saved_pid_file_name
 

Macro Definition Documentation

◆ CF_INIT_TLS_AUTH_STANDALONE

#define CF_INIT_TLS_AUTH_STANDALONE   (1<<2)

Definition at line 68 of file init.c.

Referenced by do_init_crypto_tls(), and init_instance().

◆ CF_INIT_TLS_MULTI

#define CF_INIT_TLS_MULTI   (1<<1)

Definition at line 67 of file init.c.

Referenced by do_init_crypto_tls(), and init_instance().

◆ CF_LOAD_PERSISTED_PACKET_ID

#define CF_LOAD_PERSISTED_PACKET_ID   (1<<0)

Definition at line 66 of file init.c.

Referenced by init_crypto_pre(), and init_instance().

Function Documentation

◆ ce_management_query_proxy()

static bool ce_management_query_proxy ( struct context c)
static

◆ ce_management_query_remote()

static bool ce_management_query_remote ( struct context c)
static

◆ clear_remote_addrlist()

static void clear_remote_addrlist ( struct link_socket_addr lsa,
bool  free 
)
static

◆ close_context()

void close_context ( struct context c,
int  sig,
unsigned int  flags 
)

◆ close_instance()

void close_instance ( struct context c)

◆ close_management()

void close_management ( void  )

Definition at line 4093 of file init.c.

References management_close().

Referenced by open_management(), and openvpn_main().

◆ context_clear()

void context_clear ( struct context c)

Definition at line 73 of file init.c.

References CLEAR.

Referenced by context_clear_all_except_first_time(), and do_test_crypto().

◆ context_clear_1()

void context_clear_1 ( struct context c)

Definition at line 79 of file init.c.

References context::c1, and CLEAR.

Referenced by context_init_1().

◆ context_clear_2()

void context_clear_2 ( struct context c)

Definition at line 85 of file init.c.

References context::c2, and CLEAR.

Referenced by tunnel_point_to_point(), tunnel_server_tcp(), and tunnel_server_udp_single_threaded().

◆ context_clear_all_except_first_time()

void context_clear_all_except_first_time ( struct context c)

Definition at line 91 of file init.c.

References context_clear(), context::first_time, and context::persist.

Referenced by openvpn_main().

◆ context_gc_free()

void context_gc_free ( struct context c)

◆ context_init_1()

void context_init_1 ( struct context c)

◆ do_alloc_route_list()

static void do_alloc_route_list ( struct context c)
static

◆ do_close_check_if_restart_permitted()

static void do_close_check_if_restart_permitted ( struct context c)
static

◆ do_close_event_set()

static void do_close_event_set ( struct context c)
static

Definition at line 3731 of file init.c.

References context::c2, event_free(), context_2::event_set, and context_2::event_set_owned.

Referenced by close_instance().

◆ do_close_fragment()

static void do_close_fragment ( struct context c)
static

Definition at line 3697 of file init.c.

References context::c2, context_2::fragment, and fragment_free().

Referenced by close_instance().

◆ do_close_free_buf()

static void do_close_free_buf ( struct context c)
static

Definition at line 3577 of file init.c.

References context_2::buffers, context_2::buffers_owned, context::c2, and free_context_buffers().

Referenced by close_instance().

◆ do_close_free_key_schedule()

static void do_close_free_key_schedule ( struct context c,
bool  free_ssl_ctx 
)
static

◆ do_close_ifconfig_pool_persist()

static void do_close_ifconfig_pool_persist ( struct context c)
static

◆ do_close_link_socket()

static void do_close_link_socket ( struct context c)
static

◆ do_close_packet_id()

static void do_close_packet_id ( struct context c)
static

◆ do_close_plugins()

static void do_close_plugins ( struct context c)
static

◆ do_close_status_output()

static void do_close_status_output ( struct context c)
static

◆ do_close_tls()

static void do_close_tls ( struct context c)
static

◆ do_close_tun()

static void do_close_tun ( struct context c,
bool  force 
)
static

◆ do_close_tun_simple()

static void do_close_tun_simple ( struct context c)
static

◆ do_compute_occ_strings()

static void do_compute_occ_strings ( struct context c)
static

◆ do_deferred_options()

bool do_deferred_options ( struct context c,
const unsigned int  found 
)

◆ do_env_set_destroy()

static void do_env_set_destroy ( struct context c)
static

Definition at line 3814 of file init.c.

References context::c2, env_set_destroy(), context_2::es, and context_2::es_owned.

Referenced by close_instance().

◆ do_event_set_init()

static void do_event_set_init ( struct context c,
bool  need_us_timeout 
)
static

◆ do_genkey()

bool do_genkey ( const struct options options)

◆ do_hold()

static bool do_hold ( int  holdtime)
static

Definition at line 2417 of file init.c.

References management_hold().

Referenced by do_startup_pause(), open_management(), and socket_restart_pause().

◆ do_inherit_env()

static void do_inherit_env ( struct context c,
const struct env_set src 
)
static

Definition at line 3806 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().

◆ do_inherit_plugins()

static void do_inherit_plugins ( struct context c,
const struct context src 
)
static

Definition at line 3935 of file init.c.

References plugin_list_inherit(), context::plugins, and context::plugins_owned.

Referenced by inherit_context_child().

◆ do_init_auth_token_key()

static void do_init_auth_token_key ( struct context c)
static

◆ do_init_buffers()

static void do_init_buffers ( struct context c)
static

◆ do_init_crypto()

static void do_init_crypto ( struct context c,
const unsigned int  flags 
)
static

◆ do_init_crypto_none()

static void do_init_crypto_none ( const struct context c)
static

Definition at line 3071 of file init.c.

References ASSERT, M_WARN, msg, context::options, and options::test_crypto.

Referenced by do_init_crypto().

◆ do_init_crypto_static()

static void do_init_crypto_static ( struct context c,
const unsigned int  flags 
)
static

◆ do_init_crypto_tls()

static void do_init_crypto_tls ( struct context c,
const unsigned int  flags 
)
static

Definition at line 2812 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_user_pass_file, options::auth_user_pass_file, 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, check_replay_consistency(), key_type::cipher, cipher_kt_mode_ofb_cfb(), context_1::ciphername, CLEAR, options::client_config_dir, tls_options::client_config_dir_exclusive, CO_MUTE_REPLAY_WARNINGS, CO_PACKET_ID_LONG_FORM, 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, crypto_adjust_frame_parameters(), tls_options::crypto_flags, crypto_max_overhead(), tls_options::disable_occ, do_init_crypto_tls_c1(), tls_options::ekm_label, tls_options::ekm_label_size, tls_options::ekm_size, tls_options::es, context_2::es, crypto_options::flags, context_2::frame, tls_options::frame, frame_add_to_extra_frame(), 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::ncp_enabled, options::ncp_enabled, tls_options::net_ctx, context::net_ctx, tls_options::ns_cert_type, options::ns_cert_type, options::occ, tls_wrap_ctx::opt, context::options, 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, options::replay, tls_options::replay_time, options::replay_time, tls_options::replay_window, options::replay_window, options::sc_info, tls_options::sci, tls_options::server, tls_options::single_session, options::single_session, socket_adjust_frame_parameters(), key_schedule::ssl_ctx, tls_options::ssl_ctx, tls_options::ssl_flags, options::ssl_flags, tls_options::tcp_mode, options::test_crypto, tls_adjust_frame_parameters(), connection_entry::tls_auth_file, key_schedule::tls_auth_key_type, context_2::tls_auth_standalone, tls_auth_standalone_init(), options::tls_client, tls_crypt_adjust_frame_parameters(), connection_entry::tls_crypt_file, tls_options::tls_crypt_v2, connection_entry::tls_crypt_v2_file, 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_cert, 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, tls_options::verify_command, tls_options::verify_export_cert, tls_options::verify_hash, options::verify_hash, tls_options::verify_hash_algo, options::verify_hash_algo, 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().

◆ do_init_crypto_tls_c1()

static void do_init_crypto_tls_c1 ( struct context c)
static

◆ do_init_finalize_tls_frame()

static void do_init_finalize_tls_frame ( struct context c)
static

◆ do_init_first_time()

static void do_init_first_time ( struct context c)
static

◆ do_init_fragment()

static void do_init_fragment ( struct context c)
static

◆ do_init_frame()

static void do_init_frame ( struct context c)
static

◆ do_init_frame_tls()

static void do_init_frame_tls ( struct context c)
static

Definition at line 3334 of file init.c.

References do_init_finalize_tls_frame().

Referenced by init_instance().

◆ do_init_route_ipv6_list()

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 
)
static

◆ do_init_route_list()

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

◆ do_init_server_poll_timeout()

static void do_init_server_poll_timeout ( struct context c)
static

◆ do_init_socket_1()

static void do_init_socket_1 ( struct context c,
const int  mode 
)
static

◆ do_init_socket_2()

static void do_init_socket_2 ( struct context c)
static

◆ do_init_timers()

static void do_init_timers ( struct context c,
bool  deferred 
)
static

◆ do_init_tls_wrap_key()

static void do_init_tls_wrap_key ( struct context c)
static

◆ do_init_traffic_shaper()

static void do_init_traffic_shaper ( struct context c)
static

Definition at line 1472 of file init.c.

References context::c2, context::options, options::shaper, context_2::shaper, and shaper_msg().

Referenced by do_deferred_options(), and init_instance().

◆ do_init_tun()

static void do_init_tun ( struct context c)
static

◆ do_link_socket_new()

static void do_link_socket_new ( struct context c)
static

◆ do_open_ifconfig_pool_persist()

static void do_open_ifconfig_pool_persist ( struct context c)
static

◆ do_open_status_output()

static void do_open_status_output ( struct context c)
static

◆ do_open_tun()

static bool do_open_tun ( struct context c)
static

◆ do_option_warnings()

static void do_option_warnings ( struct context c)
static

◆ do_persist_tuntap()

bool do_persist_tuntap ( const struct options options,
openvpn_net_ctx_t ctx 
)

◆ do_print_data_channel_mtu_parms()

static void do_print_data_channel_mtu_parms ( struct context c)
static

◆ do_route()

void 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 
)

◆ do_setup_fast_io()

static void do_setup_fast_io ( struct context c)
static

◆ do_signal_on_tls_errors()

static void do_signal_on_tls_errors ( struct context c)
static

Definition at line 3862 of file init.c.

References context::c2, context::options, SIGTERM, SIGUSR1, options::tls_exit, and context_2::tls_exit_signal.

Referenced by init_instance().

◆ do_startup_pause()

static void do_startup_pause ( struct context c)
static

Definition at line 2510 of file init.c.

References do_hold(), context::first_time, and socket_restart_pause().

Referenced by init_instance().

◆ do_test_crypto()

bool do_test_crypto ( const struct options o)

◆ do_uid_gid_chroot()

static void do_uid_gid_chroot ( struct context c,
bool  no_delay 
)
static

◆ do_up()

bool do_up ( struct context c,
bool  pulled_options,
unsigned int  option_types_found 
)

◆ format_common_name()

const char* format_common_name ( struct context c,
struct gc_arena gc 
)

◆ frame_finalize_options()

static void frame_finalize_options ( struct context c,
const struct options o 
)
static

◆ free_context_buffers()

void free_context_buffers ( struct context_buffers b)

◆ inherit_context_child()

void inherit_context_child ( struct context dest,
const struct context src 
)

◆ inherit_context_top()

void inherit_context_top ( struct context dest,
const struct context src 
)

◆ init_connection_list()

static void init_connection_list ( struct context c)
static

◆ init_context_buffers()

struct context_buffers* init_context_buffers ( const struct frame frame)

◆ init_crypto_pre()

static void init_crypto_pre ( struct context c,
const unsigned int  flags 
)
static

◆ init_instance()

void init_instance ( struct context c,
const struct env_set env,
const unsigned int  flags 
)

Definition at line 4143 of file init.c.

References AR_INTERACT, auth_retry_get(), 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, 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_socket_1(), do_init_socket_2(), 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_init_mssfix(), context_2::frame_initial, context_2::gc, gc_init(), init_management_callback_p2p(), init_proxy(), init_query_passwords(), init_verb_mute(), IS_SIG, IVM_LEVEL_2, 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(), connection_entry::proto, PROTO_TCP_SERVER, PULL_DEFINED, options::resolve_in_advance, set_check_status_error_delay(), SHAPER_DEFINED, context::sig, SIG_SOURCE_SOFT, signal_info::signal_received, signal_info::signal_text, signal_info::source, and options::up_delay.

Referenced by inherit_context_child(), and init_instance_handle_signals().

◆ init_instance_handle_signals()

void init_instance_handle_signals ( struct context c,
const struct env_set env,
const unsigned int  flags 
)

◆ init_management()

void init_management ( void  )

Definition at line 4033 of file init.c.

References management_init().

Referenced by openvpn_main().

◆ init_management_callback_p2p()

void init_management_callback_p2p ( struct context c)

◆ init_options_dev()

void init_options_dev ( struct options options)

Definition at line 1052 of file init.c.

References basename(), options::dev, options::dev_node, and string_alloc().

Referenced by openvpn_main().

◆ init_plugins()

void init_plugins ( struct context c)

◆ init_proxy()

static void init_proxy ( struct context c)
static

Definition at line 660 of file init.c.

References init_proxy_dowork().

Referenced by init_instance().

◆ init_proxy_dowork()

static void init_proxy_dowork ( struct context c)
static

◆ init_query_passwords()

void init_query_passwords ( const struct context c)

Query for private key and auth-user-pass username/passwords.

Definition at line 587 of file init.c.

References options::auth_user_pass_file, auth_user_pass_setup(), options::key_pass_file, context::options, pem_password_setup(), and options::sc_info.

Referenced by init_instance(), and openvpn_main().

◆ init_static()

bool init_static ( void  )

◆ init_verb_mute()

void init_verb_mute ( struct context c,
unsigned int  flags 
)

◆ initialization_sequence_completed()

void initialization_sequence_completed ( struct context c,
const unsigned int  flags 
)

◆ key_schedule_free()

static void key_schedule_free ( struct key_schedule ks,
bool  free_ssl_ctx 
)
static

◆ management_callback_proxy_cmd()

static bool management_callback_proxy_cmd ( void *  arg,
const char **  p 
)
static

◆ management_callback_remote_cmd()

static bool management_callback_remote_cmd ( void *  arg,
const char **  p 
)
static

◆ management_callback_send_cc_message()

static bool management_callback_send_cc_message ( void *  arg,
const char *  command,
const char *  parameters 
)
static

This method sends a custom control channel message.

This will write the control message

command parm1,parm2,..to the control channel.

Parameters
argThe context struct
commandThe command being sent
parametersthe parameters to the command
Returns
if sending was successful

Definition at line 310 of file init.c.

References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), D_PUSH, gc_free(), gc_new(), PUSH_BUNDLE_SIZE, send_control_channel_string(), and status.

Referenced by init_management_callback_p2p().

◆ management_callback_status_p2p()

static void management_callback_status_p2p ( void *  arg,
const int  version,
struct status_output so 
)
static

Definition at line 3949 of file init.c.

References print_status().

Referenced by init_management_callback_p2p().

◆ management_show_net_callback()

void management_show_net_callback ( void *  arg,
const int  msglevel 
)

◆ next_connection_entry()

static void next_connection_entry ( struct context c)
static

◆ open_management()

bool open_management ( struct context c)

◆ open_plugins()

void open_plugins ( struct context c,
const bool  import_options,
int  init_point 
)

◆ options_hash_changed_or_zero()

static bool options_hash_changed_or_zero ( const struct sha256_digest a,
const struct sha256_digest b 
)
static

Helper for do_up().

Take two option hashes and return true if they are not equal, or either one is all-zeroes.

Definition at line 2165 of file init.c.

Referenced by do_up().

◆ possibly_become_daemon()

bool possibly_become_daemon ( const struct options options)

◆ pre_setup()

void pre_setup ( const struct options options)

◆ print_openssl_info()

bool print_openssl_info ( const struct options options)

◆ pull_permission_mask()

unsigned int pull_permission_mask ( const struct context c)

◆ remove_pid_file()

void remove_pid_file ( void  )

Definition at line 4724 of file init.c.

References platform_unlink(), and saved_pid_file_name.

Referenced by openvpn_exit().

◆ reset_coarse_timers()

void reset_coarse_timers ( struct context c)

◆ restore_ncp_options()

static void restore_ncp_options ( struct context c)
static

◆ run_up_down()

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,
int  link_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

◆ save_ncp_options()

static void save_ncp_options ( struct context c)
static

◆ socket_restart_pause()

static void socket_restart_pause ( struct context c)
static

◆ test_crypto_thread()

static void* test_crypto_thread ( void *  arg)
static

◆ tun_abort()

void tun_abort ( void  )

Definition at line 2145 of file init.c.

References do_close_tun(), and static_context.

Referenced by openvpn_exit().

◆ uninit_management_callback()

void uninit_management_callback ( void  )

◆ uninit_proxy()

static void uninit_proxy ( struct context c)
static

Definition at line 666 of file init.c.

References uninit_proxy_dowork().

Referenced by close_instance().

◆ uninit_proxy_dowork()

static void uninit_proxy_dowork ( struct context c)
static

◆ uninit_static()

void uninit_static ( void  )

Definition at line 1011 of file init.c.

References free_ssl_lib().

Referenced by openvpn_main().

◆ update_options_ce_post()

static void update_options_ce_post ( struct options options)
static

◆ write_pid_file()

void write_pid_file ( const char *  filename,
const char *  chroot_dir 
)

Definition at line 4694 of file init.c.

References M_ERR, msg, platform_fopen(), platform_getpid(), and saved_pid_file_name.

Referenced by openvpn_main().

Variable Documentation

◆ saved_pid_file_name

const char* saved_pid_file_name
static

Definition at line 61 of file init.c.

Referenced by remove_pid_file(), and write_pid_file().

◆ static_context

struct context* static_context
static

Definition at line 60 of file init.c.

Referenced by tun_abort().