OpenVPN
init.h File Reference
#include "openvpn.h"
Include dependency graph for init.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BASE_N_EVENTS   5
#define IVM_LEVEL_1   (1 << 0)
#define IVM_LEVEL_2   (1 << 1)
#define CC_GC_FREE   (1 << 0)
#define CC_USR1_TO_HUP   (1 << 1)
#define CC_HARD_USR1_TO_HUP   (1 << 2)
#define CC_NO_CLOSE   (1 << 3)
#define ISC_ERRORS   (1 << 0)
#define ISC_SERVER   (1 << 1)
#define ISC_ROUTE_ERRORS   (1 << 2)

Functions

void context_clear_2 (struct context *c)
void context_init_1 (struct context *c)
void context_clear_all_except_first_time (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)
void pre_setup (const struct options *options)
void init_instance_handle_signals (struct context *c, const struct env_set *env, const unsigned int flags)
void init_query_passwords (const struct context *c)
 Query for private key and auth-user-pass username/passwords.
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)
void close_instance (struct context *c)
void do_test_crypto (struct context *o)
void context_gc_free (struct context *c)
bool do_up (struct context *c, bool pulled_options, uint64_t option_types_found)
bool do_update (struct context *c, uint64_t option_types_found)
 A simplified version of the do_up() function.
uint64_t pull_permission_mask (const struct context *c)
const char * format_common_name (struct context *c, struct gc_arena *gc)
void reset_coarse_timers (struct context *c)
bool do_deferred_options (struct context *c, const uint64_t found, const bool is_update)
void inherit_context_child (struct context *dest, const struct context *src, struct link_socket *sock)
void inherit_context_top (struct context *dest, const struct context *src)
void close_context (struct context *c, int sig, unsigned int flags)
struct context_buffers * init_context_buffers (const struct frame *frame)
void free_context_buffers (struct context_buffers *b)
void initialization_sequence_completed (struct context *c, const unsigned int flags)
void init_management (void)
bool open_management (struct context *c)
void close_management (void)
void management_show_net_callback (void *arg, const msglvl_t msglevel)
void init_management_callback_p2p (struct context *c)
void uninit_management_callback (void)
void init_plugins (struct context *c)
void open_plugins (struct context *c, const bool import_options, int init_point)
void tun_abort (void)
void write_pid_file (const char *filename, const char *chroot_dir)
void remove_pid_file (void)
void persist_client_stats (struct context *c)

Macro Definition Documentation

◆ BASE_N_EVENTS

#define BASE_N_EVENTS   5

Definition at line 32 of file init.h.

Referenced by do_event_set_init(), and multi_io_init().

◆ CC_GC_FREE

#define CC_GC_FREE   (1 << 0)

Definition at line 109 of file init.h.

Referenced by close_context(), multi_close_instance(), and multi_top_free().

◆ CC_HARD_USR1_TO_HUP

#define CC_HARD_USR1_TO_HUP   (1 << 2)

Definition at line 111 of file init.h.

Referenced by close_context(), tunnel_point_to_point(), and tunnel_server().

◆ CC_NO_CLOSE

#define CC_NO_CLOSE   (1 << 3)

Definition at line 112 of file init.h.

Referenced by close_context(), and inherit_context_child().

◆ CC_USR1_TO_HUP

#define CC_USR1_TO_HUP   (1 << 1)

Definition at line 110 of file init.h.

Referenced by close_context(), and inherit_context_child().

◆ ISC_ERRORS

#define ISC_ERRORS   (1 << 0)

Definition at line 120 of file init.h.

Referenced by check_add_routes_action(), and initialization_sequence_completed().

◆ ISC_ROUTE_ERRORS

#define ISC_ROUTE_ERRORS   (1 << 2)

Definition at line 122 of file init.h.

Referenced by check_add_routes_action(), do_open_tun(), and initialization_sequence_completed().

◆ ISC_SERVER

#define ISC_SERVER   (1 << 1)

Definition at line 121 of file init.h.

Referenced by initialization_sequence_completed(), and tunnel_server().

◆ IVM_LEVEL_1

#define IVM_LEVEL_1   (1 << 0)

Definition at line 44 of file init.h.

Referenced by do_deferred_options(), do_test_crypto(), init_early(), init_verb_mute(), and openvpn_main().

◆ IVM_LEVEL_2

#define IVM_LEVEL_2   (1 << 1)

Definition at line 45 of file init.h.

Referenced by do_deferred_options(), init_instance(), and init_verb_mute().

Function Documentation

◆ close_context()

◆ close_instance()

◆ close_management()

void close_management ( void )

Definition at line 4385 of file init.c.

References management_close().

Referenced by open_management(), and openvpn_main().

◆ context_clear_2()

void context_clear_2 ( struct context * c)

Definition at line 89 of file init.c.

References context::c2, and CLEAR.

Referenced by tunnel_point_to_point(), and tunnel_server().

◆ context_clear_all_except_first_time()

void context_clear_all_except_first_time ( struct context * c)

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

◆ do_deferred_options()

◆ do_genkey()

◆ do_persist_tuntap()

◆ do_route()

◆ do_test_crypto()

◆ do_up()

◆ do_update()

bool do_update ( struct context * c,
uint64_t option_types_found )

A simplified version of the do_up() function.

This function is called after receiving a successful PUSH_UPDATE message. It closes and reopens the TUN device to apply the updated options.

Parameters
cThe context structure.
option_types_foundThe options found in the PUSH_UPDATE message.
Returns
true on success.
false on error.

Definition at line 2459 of file init.c.

References context::c1, context::c2, CLEAR, D_PUSH_ERRORS, context_2::did_open_tun, do_close_tun(), do_deferred_options(), do_open_tun(), context_2::do_up_ran, event_timeout_init(), initialization_sequence_completed(), M_NONFATAL, management_sleep(), msg, now, context::options, context_1::pulled_options_digest_save, 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, tun_standby_init(), context_1::tuntap, tuntap_is_dco_win(), and update_time().

Referenced by incoming_push_message().

◆ format_common_name()

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

◆ free_context_buffers()

◆ inherit_context_child()

◆ inherit_context_top()

◆ init_context_buffers()

◆ 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 4336 of file init.c.

References management_init().

Referenced by openvpn_main().

◆ init_management_callback_p2p()

◆ init_options_dev()

void init_options_dev ( struct options * options)

Definition at line 941 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_query_passwords()

void init_query_passwords ( const struct context * c)

◆ init_static()

◆ init_verb_mute()

◆ initialization_sequence_completed()

◆ management_show_net_callback()

void management_show_net_callback ( void * arg,
const msglvl_t msglevel )

Definition at line 4248 of file init.c.

References msg, show_adapters(), and show_routes().

Referenced by init_management_callback_multi(), and init_management_callback_p2p().

◆ open_management()

◆ open_plugins()

◆ persist_client_stats()

void persist_client_stats ( struct context * c)

Definition at line 4409 of file init.c.

References man_persist_client_stats().

Referenced by tunnel_point_to_point().

◆ possibly_become_daemon()

bool possibly_become_daemon ( const struct options * options)

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

◆ pre_setup()

◆ print_openssl_info()

◆ pull_permission_mask()

◆ remove_pid_file()

void remove_pid_file ( void )

Definition at line 5005 of file init.c.

References platform_unlink(), and saved_pid_file_name.

Referenced by openvpn_exit().

◆ reset_coarse_timers()

◆ tun_abort()

void tun_abort ( void )

Definition at line 2121 of file init.c.

References do_close_tun(), and static_context.

Referenced by openvpn_exit().

◆ uninit_management_callback()

void uninit_management_callback ( void )

◆ uninit_static()

void uninit_static ( void )

Definition at line 900 of file init.c.

References free_ssl_lib().

Referenced by openvpn_main().

◆ write_pid_file()

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

Definition at line 4971 of file init.c.

References options::chroot_dir, M_ERR, M_FATAL, msg, platform_fopen(), platform_getpid(), and saved_pid_file_name.

Referenced by openvpn_main().