OpenVPN
|
#include "syshead.h"
#include "forward.h"
#include "multi.h"
#include "push.h"
#include "run_command.h"
#include "otime.h"
#include "gremlin.h"
#include "mstats.h"
#include "ssl_verify.h"
#include "ssl_ncp.h"
#include "vlan.h"
#include <inttypes.h>
#include "memdbg.h"
#include "crypto_backend.h"
#include "ssl_util.h"
#include "dco.h"
#include "reflect_filter.h"
Go to the source code of this file.
Typedefs | |
typedef enum client_connect_return(* | multi_client_connect_handler) (struct multi_context *m, struct multi_instance *mi, bool from_deferred, unsigned int *option_types_found) |
Functions | |
static void | set_cc_config (struct multi_instance *mi, struct buffer_list *cc_config) |
static void | update_mstat_n_clients (const int n_clients) |
static bool | learn_address_script (const struct multi_context *m, const struct multi_instance *mi, const char *op, const struct mroute_addr *addr) |
void | multi_ifconfig_pool_persist (struct multi_context *m, bool force) |
static void | multi_reap_range (const struct multi_context *m, int start_bucket, int end_bucket) |
static void | multi_reap_all (const struct multi_context *m) |
static struct multi_reap * | multi_reap_new (int buckets_per_pass) |
void | multi_reap_process_dowork (const struct multi_context *m) |
static void | multi_reap_free (struct multi_reap *mr) |
static int | reap_buckets_per_pass (int n_buckets) |
static uint32_t | cid_hash_function (const void *key, uint32_t iv) |
static bool | cid_compare_function (const void *key1, const void *key2) |
void | multi_init (struct multi_context *m, struct context *t, bool tcp_mode) |
const char * | multi_instance_string (const struct multi_instance *mi, bool null, struct gc_arena *gc) |
static void | generate_prefix (struct multi_instance *mi) |
void | ungenerate_prefix (struct multi_instance *mi) |
static void | multi_del_iroutes (struct multi_context *m, struct multi_instance *mi) |
static void | setenv_stats (struct multi_context *m, struct context *c) |
static void | multi_client_disconnect_setenv (struct multi_context *m, struct multi_instance *mi) |
static void | multi_client_disconnect_script (struct multi_context *m, struct multi_instance *mi) |
void | multi_close_instance (struct multi_context *m, struct multi_instance *mi, bool shutdown) |
void | multi_uninit (struct multi_context *m) |
struct multi_instance * | multi_create_instance (struct multi_context *m, const struct mroute_addr *real) |
void | multi_print_status (struct multi_context *m, struct status_output *so, const int version) |
static struct multi_instance * | multi_learn_addr (struct multi_context *m, struct multi_instance *mi, const struct mroute_addr *addr, const unsigned int flags) |
static struct multi_instance * | multi_get_instance_by_virtual_addr (struct multi_context *m, const struct mroute_addr *addr, bool cidr_routing) |
static struct multi_instance * | multi_learn_in_addr_t (struct multi_context *m, struct multi_instance *mi, in_addr_t a, int netbits, bool primary) |
static struct multi_instance * | multi_learn_in6_addr (struct multi_context *m, struct multi_instance *mi, struct in6_addr a6, int netbits, bool primary) |
static void | multi_add_iroutes (struct multi_context *m, struct multi_instance *mi) |
static void | multi_delete_dup (struct multi_context *m, struct multi_instance *new_mi) |
static void | check_stale_routes (struct multi_context *m) |
static bool | ifconfig_push_constraint_satisfied (const struct context *c) |
static void | multi_select_virtual_addr (struct multi_context *m, struct multi_instance *mi) |
static void | multi_set_virtual_addr_env (struct multi_instance *mi) |
static void | multi_client_connect_post (struct multi_context *m, struct multi_instance *mi, const char *dc_file, unsigned int *option_types_found) |
static void | multi_client_connect_post_plugin (struct multi_context *m, struct multi_instance *mi, const struct plugin_return *pr, unsigned int *option_types_found) |
enum client_connect_return | multi_client_connect_mda (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
static void | multi_client_connect_setenv (struct multi_context *m, struct multi_instance *mi) |
static bool | multi_client_set_protocol_options (struct context *c) |
Calculates the options that depend on the client capabilities based on local options and available peer info. More... | |
static void | ccs_delete_deferred_ret_file (struct multi_instance *mi) |
Delete the temporary file for the return value of client connect It also removes it from client_connect_defer_state and environment. More... | |
static bool | ccs_gen_deferred_ret_file (struct multi_instance *mi) |
Create a temporary file for the return value of client connect and puts it into the client_connect_defer_state and environment as "client_connect_deferred_file". More... | |
static enum client_connect_return | ccs_test_deferred_ret_file (struct multi_instance *mi) |
Tests whether the deferred return value file exists and returns the contained return value. More... | |
static void | ccs_delete_config_file (struct multi_instance *mi) |
Deletes the temporary file for the config directives of the client connect script and removes it into the client_connect_defer_state and environment. More... | |
static bool | ccs_gen_config_file (struct multi_instance *mi) |
Create a temporary file for the config directives of the client connect script and puts it into the client_connect_defer_state and environment as "client_connect_config_file". More... | |
static enum client_connect_return | multi_client_connect_call_plugin_v1 (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
static enum client_connect_return | multi_client_connect_call_plugin_v2 (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
static enum client_connect_return | multi_client_connect_script_deferred (struct multi_context *m, struct multi_instance *mi, unsigned int *option_types_found) |
static enum client_connect_return | multi_client_connect_call_script (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
Runs the –client-connect script if one is defined. More... | |
static bool | multi_client_setup_dco_initial (struct multi_context *m, struct multi_instance *mi, struct gc_arena *gc) |
static bool | multi_client_generate_tls_keys (struct context *c) |
Generates the data channel keys. More... | |
static void | multi_client_connect_late_setup (struct multi_context *m, struct multi_instance *mi, const unsigned int option_types_found) |
static void | multi_client_connect_early_setup (struct multi_context *m, struct multi_instance *mi) |
static enum client_connect_return | multi_client_connect_compress_migrate (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
Do the necessary modification for doing the compress migrate. More... | |
static enum client_connect_return | multi_client_connect_source_ccd (struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found) |
Try to source a dynamic config file from the –client-config-dir directory. More... | |
static void | multi_connection_established (struct multi_context *m, struct multi_instance *mi) |
void | multi_add_mbuf (struct multi_context *m, struct multi_instance *mi, struct mbuf_buffer *mb) |
static void | multi_unicast (struct multi_context *m, const struct buffer *buf, struct multi_instance *mi) |
static void | multi_bcast (struct multi_context *m, const struct buffer *buf, const struct multi_instance *sender_instance, const struct mroute_addr *sender_addr, uint16_t vid) |
static unsigned int | compute_wakeup_sigma (const struct timeval *delta) |
static void | multi_schedule_context_wakeup (struct multi_context *m, struct multi_instance *mi) |
bool | multi_process_post (struct multi_context *m, struct multi_instance *mi, const unsigned int flags) |
Perform postprocessing of a VPN tunnel instance. More... | |
void | multi_process_float (struct multi_context *m, struct multi_instance *mi) |
Handles peer floating. More... | |
void | multi_close_instance_on_signal (struct multi_context *m, struct multi_instance *mi) |
static void | multi_signal_instance (struct multi_context *m, struct multi_instance *mi, const int sig) |
bool | multi_process_incoming_link (struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags) |
Demultiplex and process a packet received over the external network interface. More... | |
bool | multi_process_incoming_tun (struct multi_context *m, const unsigned int mpp_flags) |
Determine the destination VPN tunnel of a packet received over the virtual tun/tap network interface and then process it accordingly. More... | |
struct multi_instance * | multi_get_queue (struct mbuf_set *ms) |
bool | multi_process_timeout (struct multi_context *m, const unsigned int mpp_flags) |
void | multi_process_drop_outgoing_tun (struct multi_context *m, const unsigned int mpp_flags) |
void | route_quota_exceeded (const struct multi_instance *mi) |
static bool | stale_route_check_trigger (struct multi_context *m) |
void | multi_process_per_second_timers_dowork (struct multi_context *m) |
void | multi_top_init (struct multi_context *m, struct context *top) |
void | multi_top_free (struct multi_context *m) |
static bool | is_exit_restart (int sig) |
static void | multi_push_restart_schedule_exit (struct multi_context *m, bool next_server) |
bool | multi_process_signal (struct multi_context *m) |
static void | management_callback_status (void *arg, const int version, struct status_output *so) |
static int | management_callback_n_clients (void *arg) |
static int | management_callback_kill_by_cn (void *arg, const char *del_cn) |
static int | management_callback_kill_by_addr (void *arg, const in_addr_t addr, const int port) |
static void | management_delete_event (void *arg, event_t event) |
static struct multi_instance * | lookup_by_cid (struct multi_context *m, const unsigned long cid) |
static bool | management_kill_by_cid (void *arg, const unsigned long cid, const char *kill_msg) |
static bool | management_client_pending_auth (void *arg, const unsigned long cid, const unsigned int mda_key_id, const char *extra, unsigned int timeout) |
static bool | management_client_auth (void *arg, const unsigned long cid, const unsigned int mda_key_id, const bool auth, const char *reason, const char *client_reason, struct buffer_list *cc_config) |
static char * | management_get_peer_info (void *arg, const unsigned long cid) |
void | init_management_callback_multi (struct multi_context *m) |
void | multi_assign_peer_id (struct multi_context *m, struct multi_instance *mi) |
Assigns a peer-id to a a client and adds the instance to the the instances array of the multi_context structure. More... | |
void | tunnel_server (struct context *top) |
Main event loop for OpenVPN in server mode. More... | |
Variables | |
static const multi_client_connect_handler | client_connect_handlers [] |
typedef enum client_connect_return(* multi_client_connect_handler) (struct multi_context *m, struct multi_instance *mi, bool from_deferred, unsigned int *option_types_found) |
|
static |
Deletes the temporary file for the config directives of the client connect script and removes it into the client_connect_defer_state and environment.
Definition at line 2045 of file multi.c.
References context::c2, multi_instance::client_connect_defer_state, client_connect_defer_state::config_file, multi_instance::context, D_MULTI_ERRORS, context_2::es, msg, platform_unlink(), and setenv_del().
Referenced by ccs_gen_config_file(), multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), and multi_client_connect_script_deferred().
|
static |
Delete the temporary file for the return value of client connect It also removes it from client_connect_defer_state and environment.
Definition at line 1936 of file multi.c.
References context::c2, multi_instance::client_connect_defer_state, multi_instance::context, D_MULTI_ERRORS, client_connect_defer_state::deferred_ret_file, context_2::es, msg, platform_unlink(), and setenv_del().
Referenced by ccs_gen_deferred_ret_file(), multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), and multi_client_connect_script_deferred().
|
static |
Create a temporary file for the config directives of the client connect script and puts it into the client_connect_defer_state and environment as "client_connect_config_file".
Definition at line 2069 of file multi.c.
References context::c2, ccs_delete_config_file(), multi_instance::client_connect_defer_state, client_connect_defer_state::config_file, multi_instance::context, context_2::es, gc_free(), gc_new(), context::options, platform_create_temp_file(), setenv_str(), string_alloc(), and options::tmp_dir.
Referenced by multi_client_connect_call_plugin_v1(), and multi_client_connect_call_script().
|
static |
Create a temporary file for the return value of client connect and puts it into the client_connect_defer_state and environment as "client_connect_deferred_file".
Definition at line 1962 of file multi.c.
References context::c2, ccs_delete_deferred_ret_file(), multi_instance::client_connect_defer_state, multi_instance::context, client_connect_defer_state::deferred_ret_file, context_2::es, gc_free(), gc_new(), context::options, platform_create_temp_file(), setenv_str(), string_alloc(), and options::tmp_dir.
Referenced by multi_client_connect_call_plugin_v1(), and multi_client_connect_call_script().
|
static |
Tests whether the deferred return value file exists and returns the contained return value.
Definition at line 1995 of file multi.c.
References CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, multi_instance::client_connect_defer_state, client_connect_defer_state::deferred_ret_file, M_WARN, and msg.
Referenced by multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), and multi_client_connect_script_deferred().
|
static |
Definition at line 1401 of file multi.c.
References multi_route::addr, D_MULTI_DEBUG, dmsg, gc_free(), gc_new(), hash_iterator_delete_element(), hash_iterator_free(), hash_iterator_init_range(), hash_iterator_next(), hash_n_buckets(), multi_route::last_reference, learn_address_script(), mroute_addr_print(), multi_route_defined(), multi_route_del(), now, context::options, options::stale_routes_ageing_time, multi_context::top, hash_element::value, and multi_context::vhash.
Referenced by multi_process_per_second_timers_dowork().
|
static |
|
static |
Definition at line 255 of file multi.c.
Referenced by multi_init().
|
inlinestatic |
Definition at line 2972 of file multi.c.
Referenced by multi_push_restart_schedule_exit(), and multi_schedule_context_wakeup().
|
static |
Definition at line 496 of file multi.c.
References gc_free(), gc_new(), multi_instance::msg_prefix, multi_instance_string(), set_prefix(), and strncpynt().
Referenced by multi_client_connect_early_setup(), multi_create_instance(), and multi_process_float().
|
static |
Definition at line 1431 of file multi.c.
References context::c2, context::options, options::push_ifconfig_constraint_defined, options::push_ifconfig_constraint_netmask, options::push_ifconfig_constraint_network, context_2::push_ifconfig_defined, and context_2::push_ifconfig_local.
Referenced by multi_client_connect_late_setup().
void init_management_callback_multi | ( | struct multi_context * | m | ) |
Definition at line 4119 of file multi.c.
References management_callback::arg, CLEAR, management_callback::client_auth, management_callback::client_pending_auth, management_callback::delete_event, management_callback::flags, management_callback::get_peer_info, management_callback::kill_by_addr, management_callback::kill_by_cid, management_callback::kill_by_cn, management_callback_kill_by_addr(), management_callback_kill_by_cn(), management_callback_n_clients(), management_callback_status(), management_client_auth(), management_client_pending_auth(), management_delete_event(), management_get_peer_info(), management_kill_by_cid(), management_set_callback(), management_show_net_callback(), MCF_SERVER, management_callback::n_clients, management_callback::show_net, and management_callback::status.
Referenced by tunnel_server_tcp(), and tunnel_server_udp().
|
static |
Definition at line 3830 of file multi.c.
Referenced by multi_process_signal().
|
static |
Definition at line 93 of file multi.c.
References argv_free(), argv_new(), argv_parse_cmd(), argv_printf(), argv_printf_cat(), context::c2, multi_instance::context, env_set_create(), es, context_2::es, argv::gc, gc_free(), gc_new(), options::learn_address_script, M_WARN, mroute_addr_print(), msg, OPENVPN_PLUGIN_FUNC_SUCCESS, OPENVPN_PLUGIN_LEARN_ADDRESS, openvpn_run_script(), context::options, plugin_call(), plugin_defined(), context::plugins, setenv_str(), tls_common_name(), context_2::tls_multi, and multi_context::top.
Referenced by check_stale_routes(), multi_learn_addr(), multi_reap_range(), and show_p2mp_parms().
|
static |
Definition at line 3991 of file multi.c.
References multi_context::cid_hash, multi_instance::halt, and hash_lookup().
Referenced by management_client_auth(), management_client_pending_auth(), management_get_peer_info(), and management_kill_by_cid().
|
static |
Definition at line 3950 of file multi.c.
References openvpn_sockaddr::addr, mroute_addr::addr, CLEAR, multi_instance::halt, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), openvpn_sockaddr::in4, multi_context::iter, mroute_addr_equal(), mroute_extract_openvpn_sockaddr(), multi_signal_instance(), mroute_addr::port, multi_instance::real, and hash_element::value.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3924 of file multi.c.
References context::c2, multi_instance::context, multi_instance::halt, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), multi_context::iter, multi_signal_instance(), tls_common_name(), context_2::tls_multi, and hash_element::value.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3917 of file multi.c.
References multi_context::n_clients.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3902 of file multi.c.
References multi_print_status(), and multi_context::status_file_version.
Referenced by init_management_callback_multi().
|
static |
Definition at line 4061 of file multi.c.
References buffer_list_free(), context::c2, CAS_WAITING_AUTH, multi_instance::cc_config, multi_instance::context, D_MULTI_LOW, lookup_by_cid(), msg, tls_multi::multi_state, np(), set_cc_config(), tls_authenticate_key(), and context_2::tls_multi.
Referenced by init_management_callback_multi().
|
static |
Definition at line 4022 of file multi.c.
References context::c2, multi_instance::context, tls_session::key, KS_PRIMARY, lookup_by_cid(), key_state::mda_key_id, multi_schedule_context_wakeup(), reschedule_multi_process(), send_auth_pending_messages(), tls_multi::session, context_2::tls_multi, TM_ACTIVE, and TM_INITIAL.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3981 of file multi.c.
References multi_context::mtcp, and multi_tcp_delete_event().
Referenced by init_management_callback_multi().
|
static |
Definition at line 4101 of file multi.c.
References context::c2, multi_instance::context, lookup_by_cid(), tls_multi::peer_info, and context_2::tls_multi.
Referenced by init_management_callback_multi().
|
static |
Definition at line 4005 of file multi.c.
References multi_instance::context, lookup_by_cid(), multi_schedule_context_wakeup(), and send_restart().
Referenced by init_management_callback_multi().
|
static |
Definition at line 1314 of file multi.c.
References context::c1, multi_instance::context, D_MULTI_LOW, DEV_TYPE_TUN, multi_instance::did_iroutes, gc_free(), gc_new(), options::iroutes, options::iroutes_ipv6, mroute_helper_add_iroute46(), msg, multi_instance_string(), multi_learn_in6_addr(), multi_learn_in_addr_t(), iroute::netbits, iroute_ipv6::netbits, iroute::network, iroute_ipv6::network, iroute::next, iroute_ipv6::next, context::options, print_in6_addr(), print_in_addr_t(), multi_context::route_helper, TUNNEL_TYPE, and context_1::tuntap.
Referenced by multi_client_connect_late_setup().
void multi_add_mbuf | ( | struct multi_context * | m, |
struct multi_instance * | mi, | ||
struct mbuf_buffer * | mb | ||
) |
Definition at line 2881 of file multi.c.
References mbuf_item::buffer, D_MULTI_DROPPED, mbuf_item::instance, multi_context::mbuf, mbuf_add_item(), msg, and multi_output_queue_ready().
Referenced by multi_bcast(), and multi_unicast().
void multi_assign_peer_id | ( | struct multi_context * | m, |
struct multi_instance * | mi | ||
) |
Assigns a peer-id to a a client and adds the instance to the the instances array of the multi_context
structure.
m | - The single multi_context structure. |
mi | - The multi_instance of the VPN tunnel to be postprocessed. |
Definition at line 4144 of file multi.c.
References ASSERT, context::c2, multi_instance::context, multi_context::instances, multi_context::max_clients, MAX_PEER_ID, tls_multi::peer_id, and context_2::tls_multi.
Referenced by multi_create_instance_tcp(), and multi_get_create_instance_udp().
|
static |
Definition at line 2921 of file multi.c.
References BLEN, mbuf_buffer::buf, multi_instance::context, multi_instance::halt, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), multi_context::iter, mbuf_alloc_buf(), mbuf_free_buf(), multi_add_mbuf(), context::options, PERF_MULTI_BCAST, perf_pop(), perf_push(), hash_element::value, and options::vlan_pvid.
Referenced by multi_process_incoming_link(), and multi_process_incoming_tun().
|
static |
Contrary to the plugin v2 API, we do not demand a working deferred plugin as all return can be handled by the files and plugin_call return success if a plugin is not defined
plugin api v1 client connect async feature has both plugin and file return status, so in cases where the file has a code that demands override, we override our return code
Definition at line 2096 of file multi.c.
References argv_free(), argv_new(), argv_printf(), ASSERT, context::c2, CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, ccs_delete_config_file(), ccs_delete_deferred_ret_file(), ccs_gen_config_file(), ccs_gen_deferred_ret_file(), ccs_test_deferred_ret_file(), cleanup(), multi_instance::client_connect_defer_state, client_connect_defer_state::config_file, multi_instance::context, client_connect_defer_state::deferred_ret_file, context_2::es, M_WARN, msg, multi_client_connect_post(), OPENVPN_PLUGIN_CLIENT_CONNECT, OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER, OPENVPN_PLUGIN_FUNC_DEFERRED, OPENVPN_PLUGIN_FUNC_SUCCESS, plugin_call(), plugin_defined(), and context::plugins.
|
static |
Definition at line 2191 of file multi.c.
References ASSERT, context::c2, CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, multi_instance::context, context_2::es, M_WARN, msg, multi_client_connect_post_plugin(), OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2, OPENVPN_PLUGIN_CLIENT_CONNECT_V2, OPENVPN_PLUGIN_FUNC_DEFERRED, OPENVPN_PLUGIN_FUNC_SUCCESS, plugin_call(), plugin_defined(), plugin_return_free(), plugin_return_init(), and context::plugins.
|
static |
Runs the –client-connect script if one is defined.
Definition at line 2288 of file multi.c.
References argv_free(), argv_new(), argv_parse_cmd(), argv_printf_cat(), ASSERT, context::c2, CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, ccs_delete_config_file(), ccs_delete_deferred_ret_file(), ccs_gen_config_file(), ccs_gen_deferred_ret_file(), ccs_test_deferred_ret_file(), cleanup(), multi_instance::client_connect_defer_state, options::client_connect_script, client_connect_defer_state::config_file, multi_instance::context, context_2::es, gc_free(), gc_new(), multi_client_connect_post(), multi_client_connect_script_deferred(), openvpn_run_script(), client_connect_defer_state::option_types_found, context::options, and setenv_str().
|
static |
Do the necessary modification for doing the compress migrate.
This is implemented as a connect handler as it fits the modify config for a client paradigm and also is early enough in the chain to be overwritten by another ccd/script to do compression on a special client.
Definition at line 2569 of file multi.c.
References compress_options::alg, context::c2, CC_RET_SUCCEEDED, options::comp, COMP_ALG_STUB, COMP_F_MIGRATE, multi_instance::context, compress_options::flags, M_USAGE, OPT_P_COMP, context::options, tls_multi::peer_info, push_option(), tls_multi::remote_usescomp, and context_2::tls_multi.
|
static |
Definition at line 2533 of file multi.c.
References ASSERT, context::c1, context::c2, multi_instance::context, options::duplicate_cn, generate_prefix(), multi_client_connect_setenv(), multi_delete_dup(), multi_select_virtual_addr(), context::options, tls_lock_cert_hash_set(), tls_lock_common_name(), context_2::tls_multi, context_1::tuntap, and multi_instance::vaddr_handle.
Referenced by multi_connection_established().
|
static |
Definition at line 2412 of file multi.c.
References ASSERT, context::c1, context::c2, CAS_CONNECT_DONE, CAS_FAILED, multi_instance::context, D_MULTI_ERRORS, D_MULTI_LOW, DEV_TYPE_TUN, do_deferred_options(), gc_free(), gc_new(), ifconfig_push_constraint_satisfied(), options::iroutes, msg, multi_add_iroutes(), multi_client_generate_tls_keys(), multi_client_set_protocol_options(), multi_client_setup_dco_initial(), multi_instance_string(), multi_learn_in6_addr(), multi_learn_in_addr_t(), tls_multi::multi_state, context::options, print_in6_addr(), print_in_addr_t(), process_incoming_push_request(), options::push_ifconfig_constraint_netmask, options::push_ifconfig_constraint_network, context_2::push_ifconfig_defined, context_2::push_ifconfig_ipv6_defined, context_2::push_ifconfig_ipv6_local, context_2::push_ifconfig_local, context_2::push_request_received, remove_iroutes_from_push_route_list(), multi_instance::reporting_addr, multi_instance::reporting_addr_ipv6, context_2::tls_multi, TUNNEL_TYPE, and context_1::tuntap.
Referenced by multi_connection_established().
enum client_connect_return multi_client_connect_mda | ( | struct multi_context * | m, |
struct multi_instance * | mi, | ||
bool | deferred, | ||
unsigned int * | option_types_found | ||
) |
Definition at line 1722 of file multi.c.
References ASSERT, BSTR, buffer_entry::buf, context::c2, multi_instance::cc_config, CC_RET_SKIPPED, CC_RET_SUCCEEDED, CLIENT_CONNECT_OPT_MASK, multi_instance::context, D_IMPORT_ERRORS, context_2::es, buffer_list::head, M_OPTERR, multi_select_virtual_addr(), multi_set_virtual_addr_env(), buffer_entry::next, context::options, and options_string_import().
|
static |
Definition at line 1646 of file multi.c.
References context::c2, CLIENT_CONNECT_OPT_MASK, multi_instance::context, D_IMPORT_ERRORS, context_2::es, M_OPTERR, multi_select_virtual_addr(), multi_set_virtual_addr_env(), context::options, options_server_import(), and platform_test_file().
Referenced by multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), and multi_client_connect_script_deferred().
|
static |
Definition at line 1678 of file multi.c.
References context::c2, CLIENT_CONNECT_OPT_MASK, multi_instance::context, D_IMPORT_ERRORS, context_2::es, plugin_return::list, M_OPTERR, multi_select_virtual_addr(), multi_set_virtual_addr_env(), plugin_return::n, context::options, options_string_import(), plugin_return_defined(), plugin_return_get_column(), and openvpn_plugin_string_list::value.
Referenced by multi_client_connect_call_plugin_v2().
|
static |
Definition at line 2245 of file multi.c.
References ASSERT, CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, ccs_delete_config_file(), ccs_delete_deferred_ret_file(), ccs_test_deferred_ret_file(), multi_instance::client_connect_defer_state, client_connect_defer_state::config_file, M_INFO, msg, multi_client_connect_post(), and client_connect_defer_state::option_types_found.
Referenced by multi_client_connect_call_script().
|
static |
Definition at line 1761 of file multi.c.
References context::c2, multi_instance::context, multi_instance::created, context_2::es, gc_free(), gc_new(), get_link_socket_info(), multi_set_virtual_addr_env(), setenv_long_long(), setenv_str(), setenv_trusted(), time_string(), tls_common_name(), and context_2::tls_multi.
Referenced by multi_client_connect_early_setup(), and multi_client_connect_source_ccd().
|
static |
Try to source a dynamic config file from the –client-config-dir directory.
Definition at line 2603 of file multi.c.
References ASSERT, context::c2, CC_RET_SKIPPED, CC_RET_SUCCEEDED, CCD_DEFAULT, options::client_config_dir, CLIENT_CONNECT_OPT_MASK, multi_instance::context, D_IMPORT_ERRORS, context_2::es, gc_free(), gc_new(), M_OPTERR, multi_client_connect_setenv(), multi_select_virtual_addr(), context::options, options_server_import(), platform_gen_path(), platform_test_file(), tls_common_name(), and context_2::tls_multi.
|
static |
Definition at line 573 of file multi.c.
References argv_free(), argv_new(), argv_parse_cmd(), context::c2, options::client_disconnect_script, multi_instance::context, context_2::es, M_WARN, management_notify_client_close(), context_2::mda_context, msg, multi_client_disconnect_setenv(), OPENVPN_PLUGIN_CLIENT_DISCONNECT, OPENVPN_PLUGIN_FUNC_SUCCESS, openvpn_run_script(), context::options, plugin_call(), plugin_defined(), context::plugins, and setenv_str().
Referenced by multi_close_instance(), and multi_connection_established().
|
static |
Definition at line 560 of file multi.c.
References context::c2, multi_instance::context, multi_instance::created, context_2::es, get_link_socket_info(), now, setenv_long_long(), setenv_stats(), and setenv_trusted().
Referenced by multi_client_disconnect_script().
|
static |
Generates the data channel keys.
Definition at line 2389 of file multi.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, register_signal(), tls_multi::session, context::sig, context_2::tls_multi, tls_session_update_crypto_params(), and TM_ACTIVE.
Referenced by multi_client_connect_late_setup().
|
static |
Calculates the options that depend on the client capabilities based on local options and available peer info.
Definition at line 1792 of file multi.c.
References auth_set_client_reason(), context::c2, options::ciphername, CO_USE_CC_EXIT_NOTIFY, CO_USE_DYNAMIC_TLS_CRYPT, CO_USE_TLS_KEY_MATERIAL_EXPORT, dco_enabled(), options::enable_ncp_fallback, extract_iv_proto(), options::force_key_material_export, options::gc, gc_free(), gc_new(), get_primary_key(), options::imported_protocol_flags, key_ctx_bi::initialized, IV_PROTO_CC_EXIT_NOTIFY, IV_PROTO_DATA_V2, IV_PROTO_DYN_TLS_CRYPT, IV_PROTO_NCP_P2P, IV_PROTO_REQUEST_PUSH, IV_PROTO_TLS_KEY_EXPORT, crypto_options::key_ctx_bi, M_INFO, M_WARN, msg, options::ncp_ciphers, ncp_get_best_cipher(), context::options, tls_multi::peer_info, context_2::push_request_received, tls_multi::remote_ciphername, context_2::tls_multi, tls_peer_ncp_list(), tls_multi::use_peer_id, and options::use_peer_id.
Referenced by multi_client_connect_late_setup().
|
static |
Definition at line 2350 of file multi.c.
References context::c1, context::c2, multi_instance::context, D_DCO, tuntap::dco, dco_enabled(), dco_multi_add_new_peer(), tls_multi::dco_peer_id, dco_set_peer(), context_2::frame, msg, frame::mss_fix, multi_instance_string(), context::options, options::ping_rec_timeout, options::ping_send_timeout, context_2::tls_multi, and context_1::tuntap.
Referenced by multi_client_connect_late_setup().
void multi_close_instance | ( | struct multi_context * | m, |
struct multi_instance * | mi, | ||
bool | shutdown | ||
) |
Definition at line 602 of file multi.c.
References ASSERT, context::c2, CAS_CONNECT_DONE, CC_GC_FREE, man_def_auth_context::cid, multi_context::cid_hash, close_context(), multi_instance::context, D_MULTI_DEBUG, multi_instance::did_cid_hash, multi_instance::did_iter, multi_instance::did_real_hash, dmsg, multi_context::earliest_wakeup, multi_instance::halt, multi_context::hash, hash_remove(), multi_context::ifconfig_pool, ifconfig_pool_release(), multi_context::instances, multi_context::iter, MAX_PEER_ID, multi_context::mbuf, mbuf_dereference_instance(), context_2::mda_context, multi_context::mtcp, multi_client_disconnect_script(), multi_del_iroutes(), multi_instance_dec_refcount(), multi_set_pending(), tls_multi::multi_state, multi_tcp_dereference_instance(), multi_tcp_instance_specific_free(), multi_context::n_clients, multi_instance::n_clients_delta, tls_multi::peer_id, multi_context::pending, PERF_MULTI_CLOSE_INSTANCE, perf_pop(), perf_push(), multi_instance::real, multi_context::schedule, schedule_remove_entry(), set_cc_config(), context_2::tls_multi, ungenerate_prefix(), and update_mstat_n_clients().
Referenced by multi_close_instance_on_signal(), multi_create_instance(), multi_create_instance_tcp(), multi_delete_dup(), multi_process_float(), and multi_uninit().
void multi_close_instance_on_signal | ( | struct multi_context * | m, |
struct multi_instance * | mi | ||
) |
Definition at line 3215 of file multi.c.
References clear_prefix(), multi_instance::context, D_MULTI_LOW, multi_close_instance(), print_signal(), remap_signal(), set_prefix(), and context::sig.
Referenced by multi_process_post(), multi_signal_instance(), and multi_tcp_action().
|
static |
Definition at line 2695 of file multi.c.
References ASSERT, context::c2, CAS_FAILED, CAS_PENDING, CAS_PENDING_DEFERRED, CAS_PENDING_DEFERRED_PARTIAL, CC_RET_DEFERRED, CC_RET_FAILED, CC_RET_SKIPPED, CC_RET_SUCCEEDED, check_compression_settings_valid(), multi_instance::client_connect_defer_state, client_connect_handlers, options::comp, multi_instance::context, client_connect_defer_state::cur_handler_index, D_MULTI_ERRORS, dco_check_option(), dco_enabled(), context_2::es, management_connection_established(), context_2::mda_context, msg, multi_client_connect_early_setup(), multi_client_connect_late_setup(), multi_client_disconnect_script(), tls_multi::multi_state, multi_context::n_clients, multi_instance::n_clients_delta, client_connect_defer_state::option_types_found, context::options, context_2::tls_multi, and update_mstat_n_clients().
Referenced by multi_process_post().
struct multi_instance* multi_create_instance | ( | struct multi_context * | m, |
const struct mroute_addr * | real | ||
) |
Definition at line 753 of file multi.c.
References ALLOC_OBJ_CLEAR, context::c2, CAS_NOT_CONNECTED, man_def_auth_context::cid, multi_context::cid_counter, multi_context::cid_hash, multi_instance::context, multi_instance::created, D_MULTI_ERRORS, D_MULTI_LOW, D_MULTI_MEDIUM, multi_instance::did_cid_hash, multi_instance::did_iter, multi_instance::gc, gc_free(), gc_new(), generate_prefix(), multi_context::hash, hash_add(), hash_n_elements(), inherit_context_child(), IS_SIG, multi_context::iter, multi_context::max_clients, context_2::mda_context, MPP_PRE_SELECT, mroute_addr_init(), mroute_addr_print(), msg, multi_close_instance(), multi_instance_inc_refcount(), multi_process_post(), tls_multi::multi_state, multi_tcp_instance_specific_init(), now, PERF_MULTI_CREATE_INSTANCE, perf_pop(), perf_push(), context_2::push_request_received, multi_instance::real, context_2::tls_multi, multi_context::top, and multi_instance::vaddr_handle.
Referenced by multi_create_instance_tcp(), and multi_get_create_instance_udp().
|
static |
Definition at line 525 of file multi.c.
References context::c1, multi_instance::context, dco_delete_iroutes(), DEV_TYPE_TUN, options::iroutes, options::iroutes_ipv6, mroute_helper_del_iroute46(), iroute::netbits, iroute_ipv6::netbits, iroute::next, iroute_ipv6::next, context::options, multi_context::route_helper, TUNNEL_TYPE, and context_1::tuntap.
Referenced by multi_close_instance().
|
static |
Definition at line 1363 of file multi.c.
References context::c2, multi_instance::context, D_MULTI_LOW, multi_instance::did_iter, multi_instance::halt, hash_iterator_delete_element(), hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), multi_context::iter, msg, multi_close_instance(), tls_common_name(), context_2::tls_multi, and hash_element::value.
Referenced by multi_client_connect_early_setup().
|
static |
Definition at line 1151 of file multi.c.
References mroute_addr::addr, multi_route::addr, ASSERT, check_debug_level(), D_MULTI_DEBUG, dmsg, gc_free(), gc_new(), multi_instance::halt, hash_lookup(), multi_context::local, MR_WITH_NETBITS, mroute_addr_equal(), mroute_addr_mask_host_bits(), mroute_addr_print(), multi_instance_string(), multi_learn_addr(), MULTI_ROUTE_AGEABLE, MULTI_ROUTE_CACHE, multi_route_defined(), mroute_helper::n_net_len, mroute_helper::net_len, mroute_addr::netbits, now, route, multi_context::route_helper, mroute_addr::type, and multi_context::vhash.
Referenced by multi_process_incoming_link(), and multi_process_incoming_tun().
struct multi_instance* multi_get_queue | ( | struct mbuf_set * | ms | ) |
Definition at line 3642 of file multi.c.
References mbuf_buffer::buf, context_2::buf, mbuf_item::buffer, context::c2, clear_prefix(), multi_instance::context, D_MULTI_DEBUG, dmsg, encrypt_sign(), mbuf_buffer::flags, mbuf_item::instance, mbuf_extract_item(), mbuf_free_buf(), MF_UNICAST, PIP_MSSFIX, PIPV4_PASSTOS, PIPV6_ICMP_NOHOST_SERVER, process_ip_header(), and set_prefix().
Referenced by multi_process_outgoing_link_pre().
void multi_ifconfig_pool_persist | ( | struct multi_context * | m, |
bool | force | ||
) |
Definition at line 163 of file multi.c.
References context::c1, multi_context::ifconfig_pool, context_1::ifconfig_pool_persist, ifconfig_pool_write(), ifconfig_pool_write_trigger(), and multi_context::top.
Referenced by multi_process_per_second_timers_dowork(), tunnel_server_tcp(), and tunnel_server_udp().
void multi_init | ( | struct multi_context * | m, |
struct context * | t, | ||
bool | tcp_mode | ||
) |
Definition at line 292 of file multi.c.
References ASSERT, context::c1, options::cf_initial_max, options::cf_initial_per, options::cf_max, options::cf_per, cid_compare_function(), multi_context::cid_hash, cid_hash_function(), CLEAR, D_MULTI_LOW, multi_context::deferred_shutdown_signal, options::dev, options::dev_type, dev_type_enum(), DEV_TYPE_TUN, DEV_TYPE_UNDEF, options::duplicate_cn, multi_context::enable_c2c, options::enable_c2c, event_timeout_init(), frequency_limit_init(), get_random(), multi_context::hash, hash_init(), options::ifconfig_ipv6_pool_base, options::ifconfig_ipv6_pool_defined, options::ifconfig_ipv6_pool_netbits, multi_context::ifconfig_pool, IFCONFIG_POOL_30NET, options::ifconfig_pool_defined, options::ifconfig_pool_end, IFCONFIG_POOL_INDIV, ifconfig_pool_init(), context_1::ifconfig_pool_persist, ifconfig_pool_read(), options::ifconfig_pool_start, initial_rate_limit_init(), multi_context::initial_rate_limiter, multi_context::instances, multi_context::iter, multi_context::local, tuntap::local, M_INFO, multi_context::max_clients, options::max_clients, multi_context::mbuf, mbuf_init(), mroute_addr_compare_function(), mroute_addr_hash_function(), mroute_extract_in_addr_t(), mroute_helper_init(), msg, multi_context::mtcp, MULTI_CACHE_ROUTE_TTL, multi_reap_new(), multi_tcp_init(), options::n_bcast_buf, multi_context::new_connection_limiter, context::options, options::real_hash_size, reap_buckets_per_pass(), multi_context::reaper, multi_context::route_helper, multi_context::schedule, schedule_init(), deferred_signal_schedule_entry::signal_received, options::stale_routes_ageing_time, multi_context::stale_routes_check_et, options::stale_routes_check_interval, multi_context::status_file_version, options::status_file_version, multi_context::tcp_queue_limit, options::tcp_queue_limit, TOP_NET30, options::topology, context_1::tuntap, multi_context::vhash, and options::virtual_hash_size.
Referenced by tunnel_server_tcp(), and tunnel_server_udp().
const char* multi_instance_string | ( | const struct multi_instance * | mi, |
bool | null, | ||
struct gc_arena * | gc | ||
) |
Definition at line 465 of file multi.c.
References alloc_buf_gc(), BSTR, buf_printf(), context::c2, check_debug_level(), multi_instance::context, D_DCO_DEBUG, dco_enabled(), mroute_addr_print(), MULTI_PREFIX_MAX_LENGTH, context::options, tls_multi::peer_id, multi_instance::real, tls_common_name(), and context_2::tls_multi.
Referenced by generate_prefix(), multi_add_iroutes(), multi_client_connect_late_setup(), multi_client_setup_dco_initial(), multi_get_instance_by_virtual_addr(), multi_learn_addr(), multi_process_float(), multi_select_virtual_addr(), multi_tcp_post(), and route_quota_exceeded().
|
static |
Definition at line 1058 of file multi.c.
References multi_route::addr, ALLOC_OBJ, mroute_helper::cache_generation, multi_route::cache_generation, D_MULTI_LOW, multi_route::flags, gc_free(), gc_new(), hash_add_fast(), hash_bucket(), hash_lookup_fast(), hash_value(), multi_route::instance, hash_element::key, multi_route::last_reference, learn_address_script(), multi_context::local, mroute_addr_equal(), mroute_addr_print(), mroute_learnable_address(), msg, multi_instance_inc_refcount(), multi_instance_string(), MULTI_ROUTE_CACHE, multi_route_defined(), multi_route_del(), now, multi_context::route_helper, route_quota_inc(), route_quota_test(), hash_element::value, and multi_context::vhash.
Referenced by multi_get_instance_by_virtual_addr(), multi_learn_in6_addr(), multi_learn_in_addr_t(), and multi_process_incoming_link().
|
static |
Definition at line 1270 of file multi.c.
References mroute_addr::addr, ASSERT, context::c2, multi_instance::context, dco_install_iroute(), management_learn_addr(), context_2::mda_context, MR_ADDR_IPV6, MR_WITH_NETBITS, mroute_addr_mask_host_bits(), multi_learn_addr(), and mroute_addr::netbits.
Referenced by multi_add_iroutes(), and multi_client_connect_late_setup().
|
static |
Definition at line 1230 of file multi.c.
References openvpn_sockaddr::addr, mroute_addr::addr, ASSERT, context::c2, CLEAR, multi_instance::context, dco_install_iroute(), openvpn_sockaddr::in4, management_learn_addr(), context_2::mda_context, MR_WITH_NETBITS, mroute_extract_openvpn_sockaddr(), multi_learn_addr(), and mroute_addr::netbits.
Referenced by multi_add_iroutes(), and multi_client_connect_late_setup().
void multi_print_status | ( | struct multi_context * | m, |
struct status_output * | so, | ||
const int | version | ||
) |
Definition at line 843 of file multi.c.
References context::c1, context::c2, man_def_auth_context::cid, options::ciphername, multi_instance::context, counter_format, multi_instance::created, D_MULTI_DEBUG, tuntap::dco, dco_enabled(), dco_get_peer_stats_multi(), context_2::dco_read_bytes, context_2::dco_write_bytes, ENABLE_MANAGEMENT, multi_instance::gc, gc_free(), gc_new(), multi_instance::halt, multi_context::hash, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), hash_n_elements(), IA_EMPTY_IF_UNDEF, context_2::link_read_bytes, context_2::link_write_bytes, multi_context::mbuf, mbuf_maximum_queued(), context_2::mda_context, mroute_addr_print(), msg, MULTI_ROUTE_CACHE, multi_route_defined(), now, context::options, tls_multi::peer_id, print_in6_addr(), print_in_addr_t(), multi_instance::real, multi_instance::reporting_addr, multi_instance::reporting_addr_ipv6, route, status_flush(), status_printf(), status_reset(), time_string(), title_string, tls_common_name(), context_2::tls_multi, tls_username(), multi_context::top, translate_cipher_name_to_openvpn(), context_1::tuntap, hash_element::value, and multi_context::vhash.
Referenced by management_callback_status(), multi_process_per_second_timers_dowork(), and multi_process_signal().
void multi_process_drop_outgoing_tun | ( | struct multi_context * | m, |
const unsigned int | mpp_flags | ||
) |
Definition at line 3707 of file multi.c.
References ASSERT, buf_reset(), context::c2, clear_prefix(), multi_instance::context, D_MULTI_ERRORS, buffer::len, msg, multi_process_post(), multi_context::pending, set_prefix(), and context_2::to_tun.
Referenced by multi_tcp_dispatch().
void multi_process_float | ( | struct multi_context * | m, |
struct multi_instance * | mi | ||
) |
Handles peer floating.
If peer is floated to a taken address, either drops packet (if peer that owns address has different CN) or disconnects existing peer. Updates multi_instance with new address, updates hashtables in multi_context.
Definition at line 3138 of file multi.c.
References link_socket_addr::actual, ASSERT, context_2::buf, context::c2, cert_hash_compare(), man_def_auth_context::cid, multi_context::cid_hash, multi_instance::context, D_MULTI_LOW, D_MULTI_MEDIUM, link_socket_actual::dest, context_2::from, multi_instance::gc, gc_free(), gc_new(), generate_prefix(), multi_context::hash, hash_add(), hash_bucket(), hash_lookup_fast(), hash_remove(), hash_value(), multi_context::iter, buffer::len, context_2::link_socket, context_2::link_socket_info, link_socket_info::lsa, context_2::mda_context, mroute_addr_print(), mroute_extract_openvpn_sockaddr(), msg, multi_close_instance(), multi_instance_string(), tls_multi::peer_id, print_link_socket_actual(), multi_instance::real, tls_common_name(), context_2::tls_multi, tls_update_remote_addr(), context_2::to_link_addr, multi_context::top, and hash_element::value.
Referenced by multi_process_incoming_link().
void multi_process_per_second_timers_dowork | ( | struct multi_context * | m | ) |
Definition at line 3787 of file multi.c.
References context::c1, check_stale_routes(), multi_ifconfig_pool_persist(), multi_print_status(), multi_reap_process(), context::options, stale_route_check_trigger(), options::stale_routes_check_interval, multi_context::status_file_version, context_1::status_output, status_trigger(), and multi_context::top.
Referenced by multi_process_per_second_timers().
bool multi_process_post | ( | struct multi_context * | m, |
struct multi_instance * | mi, | ||
const unsigned int | flags | ||
) |
Perform postprocessing of a VPN tunnel instance.
After some VPN tunnel activity has taken place, the VPN tunnel's state may need updating and some follow-up action may be required. This function controls the necessary postprocessing. It is called by many other functions that handle VPN tunnel related activity, such as multi_process_incoming_link()
, multi_process_outgoing_link()
, multi_process_incoming_tun()
, multi_process_outgoing_tun()
, and multi_process_timeout()
, among others.
m | - The single multi_context structure. |
mi | - The multi_instance of the VPN tunnel to be postprocessed. |
flags | - Fast I/O optimization flags. |
Definition at line 3041 of file multi.c.
References ANY_OUT, auth_deferred_status::auth_control_file, key_state::authenticated, context::c2, multi_instance::client_connect_defer_state, multi_instance::context, client_connect_defer_state::deferred_ret_file, context_2::fragment, is_cas_pending(), IS_SIG, tls_session::key, KS_AUTH_DEFERRED, KS_AUTH_FALSE, KS_PRIMARY, buffer::len, MPP_CLOSE_ON_SIGNAL, MPP_CONDITIONAL_PRE_SELECT, MPP_PRE_SELECT, MPP_RECORD_TOUCH, multi_context::mpp_touched, multi_close_instance_on_signal(), multi_connection_established(), multi_schedule_context_wakeup(), multi_set_pending(), tls_multi::multi_state, fragment_master::outgoing, multi_context::pending, key_state::plugin_auth, pre_select(), key_state::script_auth, tls_multi::session, context_2::timeval, context_2::tls_multi, TM_ACTIVE, context_2::to_link, context_2::to_tun, and multi_context::top.
Referenced by multi_create_instance(), multi_process_drop_outgoing_tun(), multi_process_incoming_link(), multi_process_incoming_tun(), multi_process_outgoing_link_dowork(), multi_process_outgoing_tun(), multi_process_timeout(), multi_tcp_dispatch(), and multi_tcp_process_outgoing_link().
bool multi_process_signal | ( | struct multi_context * | m | ) |
Definition at line 3876 of file multi.c.
References options::ce, multi_context::deferred_shutdown_signal, connection_entry::explicit_exit_notification, is_exit_restart(), M_INFO, multi_print_status(), multi_push_restart_schedule_exit(), context::options, connection_entry::proto, proto_is_dgram(), context::sig, signal_info::signal_received, deferred_signal_schedule_entry::signal_received, signal_reset(), status_close(), multi_context::status_file_version, status_open(), and multi_context::top.
bool multi_process_timeout | ( | struct multi_context * | m, |
const unsigned int | mpp_flags | ||
) |
Definition at line 3676 of file multi.c.
References clear_prefix(), multi_context::deferred_shutdown_signal, multi_context::earliest_wakeup, multi_process_post(), multi_context::schedule, schedule_remove_entry(), set_prefix(), deferred_signal_schedule_entry::signal_received, and throw_signal().
Referenced by multi_tcp_dispatch(), and tunnel_server_udp().
|
static |
Definition at line 3836 of file multi.c.
References ASSERT, compute_wakeup_sigma(), multi_instance::context, D_PUSH, multi_context::deferred_shutdown_signal, multi_instance::halt, hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), multi_context::iter, multi_schedule_context_wakeup(), openvpn_gettimeofday(), multi_context::schedule, schedule_add_entry(), send_control_channel_string(), context::sig, signal_info::signal_received, deferred_signal_schedule_entry::signal_received, signal_reset(), multi_context::top, tv_add(), hash_element::value, and deferred_signal_schedule_entry::wakeup.
Referenced by multi_process_signal().
|
static |
Definition at line 208 of file multi.c.
References multi_reap_range().
Referenced by multi_uninit().
|
static |
Definition at line 238 of file multi.c.
Referenced by multi_uninit().
|
static |
Definition at line 214 of file multi.c.
References ALLOC_OBJ, multi_reap::bucket_base, multi_reap::buckets_per_pass, multi_reap::last_call, and now.
Referenced by multi_init().
void multi_reap_process_dowork | ( | const struct multi_context * | m | ) |
Definition at line 225 of file multi.c.
References multi_reap::bucket_base, multi_reap::buckets_per_pass, hash_n_buckets(), multi_reap::last_call, multi_reap_range(), now, multi_context::reaper, and multi_context::vhash.
Referenced by multi_reap_process().
|
static |
Definition at line 175 of file multi.c.
References multi_route::addr, D_MULTI_DEBUG, dmsg, gc_free(), gc_new(), hash_iterator_delete_element(), hash_iterator_free(), hash_iterator_init_range(), hash_iterator_next(), hash_n_buckets(), learn_address_script(), mroute_addr_print(), multi_route_defined(), multi_route_del(), hash_element::value, and multi_context::vhash.
Referenced by multi_reap_all(), and multi_reap_process_dowork().
|
static |
Definition at line 2994 of file multi.c.
References ASSERT, context::c2, compute_wakeup_sigma(), multi_instance::context, openvpn_gettimeofday(), multi_context::schedule, schedule_add_entry(), context_2::timeval, tv_add(), and multi_instance::wakeup.
Referenced by management_client_pending_auth(), management_kill_by_cid(), multi_process_post(), and multi_push_restart_schedule_exit().
|
static |
Definition at line 1450 of file multi.c.
References context::c1, context::c2, CLEAR, multi_instance::context, D_MULTI_ERRORS, DEV_TYPE_TAP, DEV_TYPE_TUN, options::duplicate_cn, gc_free(), gc_new(), options::ifconfig_ipv6_netbits, options::ifconfig_ipv6_pool_defined, multi_context::ifconfig_pool, ifconfig_pool_acquire(), options::ifconfig_pool_defined, options::ifconfig_pool_netmask, ifconfig_pool_release(), tuntap::local, tuntap::local_ipv6, M_INFO, msg, multi_instance_string(), context::options, print_in6_addr(), print_in_addr_t(), context_2::push_ifconfig_defined, options::push_ifconfig_defined, context_2::push_ifconfig_ipv6_defined, options::push_ifconfig_ipv6_defined, context_2::push_ifconfig_ipv6_local, options::push_ifconfig_ipv6_local, context_2::push_ifconfig_ipv6_netbits, options::push_ifconfig_ipv6_netbits, context_2::push_ifconfig_ipv6_remote, options::push_ifconfig_ipv6_remote, context_2::push_ifconfig_local, options::push_ifconfig_local, context_2::push_ifconfig_local_alias, options::push_ifconfig_local_alias, context_2::push_ifconfig_remote_netmask, options::push_ifconfig_remote_netmask, tuntap::remote_netmask, tls_common_name(), context_2::tls_multi, TOP_NET30, TOP_P2P, TOP_SUBNET, TUNNEL_TOPOLOGY, TUNNEL_TYPE, context_1::tuntap, and multi_instance::vaddr_handle.
Referenced by multi_client_connect_early_setup(), multi_client_connect_mda(), multi_client_connect_post(), multi_client_connect_post_plugin(), and multi_client_connect_source_ccd().
|
static |
Definition at line 1590 of file multi.c.
References context::c1, context::c2, multi_instance::context, DEV_TYPE_TAP, DEV_TYPE_TUN, context_2::es, context_2::push_ifconfig_defined, context_2::push_ifconfig_ipv6_defined, context_2::push_ifconfig_ipv6_local, context_2::push_ifconfig_ipv6_netbits, context_2::push_ifconfig_ipv6_remote, context_2::push_ifconfig_local, context_2::push_ifconfig_remote_netmask, SA_SET_IF_NONZERO, setenv_del(), setenv_in6_addr(), setenv_in_addr_t(), setenv_int(), TOP_SUBNET, TUNNEL_TOPOLOGY, TUNNEL_TYPE, and context_1::tuntap.
Referenced by multi_client_connect_mda(), multi_client_connect_post(), multi_client_connect_post_plugin(), and multi_client_connect_setenv().
|
static |
Definition at line 3226 of file multi.c.
References multi_instance::context, multi_close_instance_on_signal(), context::sig, and signal_info::signal_received.
Referenced by management_callback_kill_by_addr(), and management_callback_kill_by_cn().
void multi_top_free | ( | struct multi_context * | m | ) |
Definition at line 3823 of file multi.c.
References context_2::buffers, context::c2, CC_GC_FREE, close_context(), free_context_buffers(), and multi_context::top.
Referenced by tunnel_server_tcp(), and tunnel_server_udp().
void multi_top_init | ( | struct multi_context * | m, |
struct context * | top | ||
) |
Definition at line 3816 of file multi.c.
References context_2::buffers, context::c2, context_2::frame, inherit_context_top(), init_context_buffers(), and multi_context::top.
Referenced by tunnel_server_tcp(), and tunnel_server_udp().
|
inlinestatic |
Definition at line 2902 of file multi.c.
References BLEN, mbuf_buffer::buf, mbuf_buffer::flags, mbuf_alloc_buf(), mbuf_free_buf(), MF_UNICAST, and multi_add_mbuf().
Referenced by multi_process_incoming_link().
void multi_uninit | ( | struct multi_context * | m | ) |
Definition at line 705 of file multi.c.
References multi_context::cid_hash, multi_instance::did_iter, frequency_limit_free(), multi_context::hash, hash_free(), hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), multi_context::ifconfig_pool, ifconfig_pool_free(), initial_rate_limit_free(), multi_context::initial_rate_limiter, multi_context::instances, multi_context::iter, multi_context::mbuf, mbuf_free(), mroute_helper_free(), multi_context::mtcp, multi_close_instance(), multi_reap_all(), multi_reap_free(), multi_tcp_free(), multi_context::new_connection_limiter, multi_context::reaper, multi_context::route_helper, multi_context::schedule, schedule_free(), hash_element::value, and multi_context::vhash.
Referenced by tunnel_server_tcp(), and tunnel_server_udp().
|
static |
Definition at line 247 of file multi.c.
References constrain_int(), REAP_DIVISOR, REAP_MAX, and REAP_MIN.
Referenced by multi_init().
void route_quota_exceeded | ( | const struct multi_instance * | mi | ) |
Definition at line 3729 of file multi.c.
References multi_instance::context, D_ROUTE_QUOTA, gc_free(), gc_new(), options::max_routes_per_client, msg, multi_instance_string(), and context::options.
Referenced by route_quota_test().
|
static |
Definition at line 74 of file multi.c.
References buffer_list_free(), and multi_instance::cc_config.
Referenced by management_client_auth(), and multi_close_instance().
|
static |
Definition at line 548 of file multi.c.
References context::c1, context::c2, tuntap::dco, dco_enabled(), dco_get_peer_stats_multi(), context_2::dco_read_bytes, context_2::dco_write_bytes, context_2::es, context_2::link_read_bytes, context_2::link_write_bytes, context::options, setenv_counter(), multi_context::top, and context_1::tuntap.
Referenced by multi_client_disconnect_setenv().
|
static |
Definition at line 3776 of file multi.c.
References CLEAR, ETT_DEFAULT, event_timeout_trigger(), and multi_context::stale_routes_check_et.
Referenced by multi_process_per_second_timers_dowork().
void ungenerate_prefix | ( | struct multi_instance * | mi | ) |
Definition at line 513 of file multi.c.
References multi_instance::msg_prefix, and set_prefix().
Referenced by multi_close_instance(), and multi_get_create_instance_udp().
|
inlinestatic |
Definition at line 82 of file multi.c.
Referenced by multi_close_instance(), and multi_connection_established().
|
static |
Definition at line 2665 of file multi.c.
Referenced by multi_connection_established().