|
OpenVPN
|
#include "syshead.h"#include "forward.h"#include "multi.h"#include "push.h"#include "run_command.h"#include "otime.h"#include "gremlin.h"#include "ssl_verify.h"#include "ssl_ncp.h"#include "vlan.h"#include "auth_token.h"#include "route.h"#include <inttypes.h>#include <string.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, uint64_t *option_types_found) |
Functions | |
| static void | set_cc_config (struct multi_instance *mi, struct buffer_list *cc_config) |
| 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, uint32_t start_bucket, uint32_t end_bucket) |
| static void | multi_reap_all (const struct multi_context *m) |
| static struct multi_reap * | multi_reap_new (uint32_t buckets_per_pass) |
| void | multi_reap_process_dowork (const struct multi_context *m) |
| static void | multi_reap_free (struct multi_reap *mr) |
| static uint32_t | reap_buckets_per_pass (uint32_t n_buckets) |
| static uint64_t | cid_hash_function (const void *key, const uint8_t hash_key[HASH_KEY_LEN]) |
| static bool | cid_compare_function (const void *key1, const void *key2) |
| static void | multi_init (struct context *t) |
| 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) |
| static void | multi_uninit (struct multi_context *m) |
| struct multi_instance * | multi_create_instance (struct multi_context *m, const struct mroute_addr *real, struct link_socket *sock) |
| static 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, uint64_t *option_types_found) |
| static void | multi_client_connect_post_plugin (struct multi_context *m, struct multi_instance *mi, const struct plugin_return *pr, uint64_t *option_types_found) |
| enum client_connect_return | multi_client_connect_mda (struct multi_context *m, struct multi_instance *mi, bool deferred, uint64_t *option_types_found) |
| static void | multi_client_connect_setenv (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. | |
| 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. | |
| 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". | |
| 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. | |
| 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. | |
| 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". | |
| static enum client_connect_return | multi_client_connect_call_plugin_v1 (struct multi_context *m, struct multi_instance *mi, bool deferred, uint64_t *option_types_found) |
| static enum client_connect_return | multi_client_connect_call_plugin_v2 (struct multi_context *m, struct multi_instance *mi, bool deferred, uint64_t *option_types_found) |
| static enum client_connect_return | multi_client_connect_script_deferred (struct multi_context *m, struct multi_instance *mi, uint64_t *option_types_found) |
| static enum client_connect_return | multi_client_connect_call_script (struct multi_context *m, struct multi_instance *mi, bool deferred, uint64_t *option_types_found) |
| Runs the –client-connect script if one is defined. | |
| 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. | |
| static void | multi_client_connect_late_setup (struct multi_context *m, struct multi_instance *mi, const uint64_t 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, uint64_t *option_types_found) |
| Do the necessary modification for doing the compress migrate. | |
| static enum client_connect_return | multi_client_connect_source_ccd (struct multi_context *m, struct multi_instance *mi, bool deferred, uint64_t *option_types_found) |
| Try to source a dynamic config file from the –client-config-dir directory. | |
| static bool | override_locked_username (struct multi_instance *mi) |
| Overrides the locked username with the username of –override-username. | |
| 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, 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. | |
| static bool | multi_check_dest_addr_allowed (struct multi_context *m, struct multi_instance *mi, struct mroute_addr *real) |
| This methods checks if a client instance is allowed to use an address. | |
| static void | multi_process_float (struct multi_context *m, struct multi_instance *mi, struct link_socket *sock) |
| Handles peer floating. | |
| 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) |
| static void | multi_process_incoming_link_data (struct multi_context *m, bool floated, struct link_socket *sock) |
| Process incoming data packet from clients. | |
| bool | multi_process_incoming_link (struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags, struct link_socket *sock) |
| Demultiplex and process a packet received over the external network interface. | |
| 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. | |
| 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) |
| static void | multi_top_init (struct context *top) |
| static 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 uint16_t port, const uint8_t proto) |
| static void | management_delete_event (void *arg, event_t event) |
| 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 struct tls_session * | lookup_session_by_mda_key_id (struct tls_multi *multi, const unsigned int mda_key_id) |
| 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. | |
| static void | multi_get_timeout (struct multi_context *multi, struct timeval *timeval) |
| Determines the earliest wakeup interval based on periodic operations. | |
| static void | tunnel_server_loop (struct multi_context *multi) |
| Main event loop for OpenVPN in point-to-multipoint server mode. | |
| void | tunnel_server (struct context *top) |
| Main event loop for OpenVPN in server mode. | |
| static void | multi_unlearn_addr (struct multi_context *m, struct multi_instance *mi, const struct mroute_addr *addr) |
| static void | multi_unlearn_in_addr_t (struct multi_context *m, struct multi_instance *mi, in_addr_t a) |
| static void | multi_unlearn_in6_addr (struct multi_context *m, struct multi_instance *mi, struct in6_addr a6) |
| void | unlearn_ifconfig (struct multi_context *m, struct multi_instance *mi) |
| void | unlearn_ifconfig_ipv6 (struct multi_context *m, struct multi_instance *mi) |
| void | update_vhash (struct multi_context *m, struct multi_instance *mi, const char *new_ip, const char *new_ipv6) |
| Update the vhash with new IP/IPv6 addresses in the multi_context when a push-update message containing ifconfig/ifconfig-ipv6 options is sent from the server. | |
| bool | multi_check_push_ifconfig_extra_route (struct multi_instance *mi, in_addr_t dest) |
| Determines if the ifconfig_push_local address falls into the range of the local IP addresses of the VPN interface (ifconfig_local with ifconfig_remote_netmask) | |
| bool | multi_check_push_ifconfig_ipv6_extra_route (struct multi_instance *mi, struct in6_addr *dest) |
| Determines if the ifconfig_ipv6_local address falls into the range of the local IP addresses of the VPN interface (ifconfig_local with ifconfig_remote_netmask) | |
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, uint64_t *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 1975 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 1868 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 1998 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, 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 1893 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, 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 1925 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 1351 of file multi.c.
References multi_route::addr, D_MULTI_DEBUG, dmsg, multi_route::flags, gc, 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(), MULTI_ROUTE_PERMANENT, 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 |
Definition at line 239 of file multi.c.
Referenced by multi_init().
|
static |
Definition at line 232 of file multi.c.
Referenced by multi_init().
|
inlinestatic |
Definition at line 2914 of file multi.c.
References ASSERT.
Referenced by multi_push_restart_schedule_exit(), and multi_schedule_context_wakeup().
|
static |
Definition at line 448 of file multi.c.
References gc, 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 1381 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 4118 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_send_push_update_broadcast(), management_callback_send_push_update_by_cid(), 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::push_update_broadcast, management_callback::push_update_by_cid, management_callback::show_net, and management_callback::status.
Referenced by tunnel_server().
|
static |
|
static |
Definition at line 83 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(), context_2::es, es, 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(), multi_unlearn_addr(), options_postprocess_verify_ce(), and show_p2mp_parms().
| struct multi_instance * lookup_by_cid | ( | struct multi_context * | m, |
| const unsigned long | cid | ||
| ) |
Definition at line 3987 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(), management_kill_by_cid(), and send_push_update().
|
static |
Definition at line 4018 of file multi.c.
References tls_session::key, KS_PRIMARY, key_state::mda_key_id, tls_multi::session, TM_ACTIVE, and TM_INITIAL.
Referenced by management_client_pending_auth().
|
static |
Definition at line 3949 of file multi.c.
References mroute_addr::addr, openvpn_sockaddr::addr, CLEAR, multi_instance::halt, openvpn_sockaddr::in4, multi_context::instances, mroute_addr::len, mroute_addr_equal(), mroute_extract_openvpn_sockaddr(), multi_signal_instance(), mroute_addr::port, mroute_addr::proto, multi_instance::real, and SIGTERM.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3927 of file multi.c.
References context::c2, multi_instance::context, multi_instance::halt, multi_context::instances, multi_context::max_peerid, multi_signal_instance(), SIGTERM, tls_common_name(), and context_2::tls_multi.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3920 of file multi.c.
References multi_context::n_clients.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3905 of file multi.c.
References multi_print_status(), and multi_context::status_file_version.
Referenced by init_management_callback_multi().
|
static |
Definition at line 4063 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 4036 of file multi.c.
References context::c2, multi_instance::context, lookup_by_cid(), lookup_session_by_mda_key_id(), multi_schedule_context_wakeup(), reschedule_multi_process(), send_auth_pending_messages(), and context_2::tls_multi.
Referenced by init_management_callback_multi().
|
static |
Definition at line 3977 of file multi.c.
References multi_context::multi_io, and multi_tcp_delete_event().
Referenced by init_management_callback_multi().
|
static |
Definition at line 4100 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 4001 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 1272 of file multi.c.
References context::c1, multi_instance::context, D_MULTI_LOW, DEV_TYPE_TUN, multi_instance::did_iroutes, gc, 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 2837 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 4145 of file multi.c.
References ASSERT, context::c2, multi_instance::context, multi_context::instances, multi_context::max_clients, MAX_PEER_ID, multi_context::max_peerid, tls_multi::rx_peer_id, and context_2::tls_multi.
Referenced by handle_connection_attempt(), and multi_create_instance_tcp().
|
static |
Definition at line 2873 of file multi.c.
References BLEN, mbuf_buffer::buf, multi_instance::context, multi_instance::halt, multi_context::instances, multi_context::max_peerid, mbuf_alloc_buf(), mbuf_free_buf(), multi_add_mbuf(), context::options, and options::vlan_pvid.
Referenced by multi_process_incoming_link_data(), and multi_process_incoming_tun().
|
static |
This methods checks if a client instance is allowed to use an address.
Reasons for disallowing a specific address are that a client might be already using that address. In that case the method needs to decide if this instance can kick out the other instance.
The method will then terminate the other instance if that check was positive.
Definition at line 3081 of file multi.c.
References context_2::buf, context::c2, cert_hash_compare(), multi_instance::context, D_MULTI_LOW, gc, gc_free(), gc_new(), multi_context::hash, hash_lookup_fast(), hash_value(), buffer::len, tls_multi::locked_cert_hash_set, tls_multi::locked_username, M_WARN, mroute_addr_print(), msg, multi_close_instance(), multi_instance_string(), multi_instance::real, tls_multi::rx_peer_id, tls_common_name(), context_2::tls_multi, and hash_element::value.
Referenced by multi_process_float().
| bool multi_check_push_ifconfig_extra_route | ( | struct multi_instance * | mi, |
| in_addr_t | dest | ||
| ) |
Determines if the ifconfig_push_local address falls into the range of the local IP addresses of the VPN interface (ifconfig_local with ifconfig_remote_netmask)
| mi | The multi-instance to check this condition for |
| dest | The destination IP address to check |
Definition at line 4441 of file multi.c.
References multi_instance::context, options::ifconfig_local, options::ifconfig_remote_netmask, and context::options.
Referenced by multi_learn_in_addr_t().
| bool multi_check_push_ifconfig_ipv6_extra_route | ( | struct multi_instance * | mi, |
| struct in6_addr * | dest | ||
| ) |
Determines if the ifconfig_ipv6_local address falls into the range of the local IP addresses of the VPN interface (ifconfig_local with ifconfig_remote_netmask)
| mi | The multi-instance to check this condition for |
| dest | The destination IPv6 address to check |
Definition at line 4462 of file multi.c.
References multi_instance::context, options::ifconfig_ipv6_local, options::ifconfig_ipv6_netbits, ipv6_net_contains_host(), and context::options.
Referenced by multi_learn_in6_addr().
|
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 2024 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 2114 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 2204 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, 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 2466 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 2431 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 2308 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, 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, | ||
| uint64_t * | option_types_found | ||
| ) |
Definition at line 1653 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 1588 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 1614 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 2163 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 1686 of file multi.c.
References context::c2, multi_instance::context, multi_instance::created, context_2::es, gc, 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().
|
static |
|
static |
Definition at line 527 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 514 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 2285 of file multi.c.
References context::c1, context::c2, options::ce, D_TLS_ERRORS, tuntap::dco, connection_entry::fragment, context_2::frame, context_2::frame_fragment, get_link_socket_info(), msg, context::options, register_signal(), tls_multi::session, context::sig, SIGUSR1, context_2::tls_multi, tls_session_update_crypto_params(), TM_ACTIVE, and context_1::tuntap.
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 1716 of file multi.c.
References auth_set_client_reason(), context::c2, cipher_kt_mode_aead(), options::ciphername, CO_EPOCH_DATA_KEY_FORMAT, CO_USE_CC_EXIT_NOTIFY, CO_USE_DYNAMIC_TLS_CRYPT, CO_USE_TLS_KEY_MATERIAL_EXPORT, tls_options::data_epoch_supported, dco_enabled(), options::enable_ncp_fallback, extract_iv_proto(), options::force_key_material_export, options::gc, gc, gc_free(), gc_new(), get_primary_key(), options::imported_protocol_flags, key_ctx_bi::initialized, IV_PROTO_CC_EXIT_NOTIFY, IV_PROTO_DATA_EPOCH, 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, options::ncp_ciphers_conf, ncp_expanded_ciphers(), ncp_get_best_cipher(), tls_session::opt, context::options, tls_multi::peer_info, context_2::push_request_received, tls_multi::remote_ciphername, tls_multi::session, context_2::tls_multi, tls_peer_ncp_list(), TM_ACTIVE, options::use_peer_id, and tls_multi::use_peer_id.
Referenced by multi_client_connect_late_setup().
|
static |
Definition at line 2262 of file multi.c.
References multi_instance::context, D_DCO, dco_enabled(), dco_multi_add_new_peer(), gc, msg, multi_instance_string(), and context::options.
Referenced by multi_client_connect_late_setup().
| void multi_close_instance | ( | struct multi_context * | m, |
| struct multi_instance * | mi, | ||
| bool | shutdown | ||
| ) |
Definition at line 558 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_real_hash, dmsg, multi_context::earliest_wakeup, multi_instance::halt, multi_context::hash, hash_remove(), multi_context::ifconfig_pool, ifconfig_pool_release(), link_socket::info, multi_context::instances, context_2::link_sockets, MAX_PEER_ID, multi_context::max_peerid, multi_context::mbuf, mbuf_dereference_instance(), context_2::mda_context, multi_client_disconnect_script(), multi_del_iroutes(), multi_instance_dec_refcount(), multi_context::multi_io, 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, multi_context::pending, link_socket_info::proto, proto_is_dgram(), multi_instance::real, tls_multi::rx_peer_id, multi_context::schedule, schedule_remove_entry(), set_cc_config(), SIGTERM, context_2::tls_multi, and ungenerate_prefix().
Referenced by multi_check_dest_addr_allowed(), multi_close_instance_on_signal(), multi_create_instance(), multi_create_instance_tcp(), multi_delete_dup(), and multi_uninit().
| void multi_close_instance_on_signal | ( | struct multi_context * | m, |
| struct multi_instance * | mi | ||
| ) |
Definition at line 3219 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_io_action(), multi_process_post(), and multi_signal_instance().
|
static |
Definition at line 2641 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, override_locked_username(), options::override_username, and context_2::tls_multi.
Referenced by multi_process_post().
| struct multi_instance * multi_create_instance | ( | struct multi_context * | m, |
| const struct mroute_addr * | real, | ||
| struct link_socket * | sock | ||
| ) |
Definition at line 702 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_MEDIUM, multi_instance::did_cid_hash, multi_instance::ev_arg, EVENT_ARG_MULTI_INSTANCE, multi_instance::gc, gc, gc_free(), gc_new(), generate_prefix(), multi_context::hash, hash_add(), hash_n_elements(), inherit_context_child(), IS_SIG, multi_context::max_clients, context_2::mda_context, event_arg::mi, MPP_PRE_SELECT, mroute_addr_init(), msg, multi_close_instance(), multi_instance_inc_refcount(), multi_process_post(), tls_multi::multi_state, multi_tcp_instance_specific_init(), now, context_2::push_request_received, multi_instance::real, context_2::tls_multi, multi_context::top, event_arg::type, event_arg::u, and multi_instance::vaddr_handle.
Referenced by handle_connection_attempt(), and multi_create_instance_tcp().
|
static |
Definition at line 477 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 1317 of file multi.c.
References context::c2, multi_instance::context, D_MULTI_LOW, multi_instance::halt, multi_context::instances, multi_context::max_peerid, msg, multi_close_instance(), tls_common_name(), and context_2::tls_multi.
Referenced by multi_client_connect_early_setup().
|
static |
Definition at line 1099 of file multi.c.
References mroute_addr::addr, multi_route::addr, ASSERT, check_debug_level(), D_MULTI_DEBUG, dmsg, gc, gc_free(), gc_new(), multi_instance::halt, hash_lookup(), mroute_addr::len, 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(), now, route, multi_context::route_helper, mroute_addr::type, and multi_context::vhash.
Referenced by multi_process_incoming_link_data(), and multi_process_incoming_tun().
| struct multi_instance * multi_get_queue | ( | struct mbuf_set * | ms | ) |
Definition at line 3651 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, context_2::link_sockets, 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().
|
static |
Determines the earliest wakeup interval based on periodic operations.
Updates the timeval to reflect the next scheduled wakeup time. Also sets multi->earliest_wakeup to the instance with the earliest wakeup.
| multi | Pointer to the multi context |
| timeval | Pointer to the timeval structure to be updated with the next wakeup time |
Definition at line 4182 of file multi.c.
References management_check_bytecount_server(), and multi_get_timeout_instance().
Referenced by tunnel_server_loop().
| void multi_ifconfig_pool_persist | ( | struct multi_context * | m, |
| bool | force | ||
| ) |
Definition at line 150 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(), and tunnel_server().
|
static |
Definition at line 269 of file multi.c.
References ASSERT, context::c1, context::c2, 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, context_2::event_set, event_timeout_init(), frequency_limit_init(), 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::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, context::multi, MULTI_CACHE_ROUTE_TTL, multi_context::multi_io, multi_io_init(), multi_reap_new(), 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, multi_context::top, TOP_NET30, options::topology, context_1::tuntap, multi_context::vhash, and options::virtual_hash_size.
Referenced by tunnel_server().
| const char * multi_instance_string | ( | const struct multi_instance * | mi, |
| bool | null, | ||
| struct gc_arena * | gc | ||
| ) |
Definition at line 418 of file multi.c.
References alloc_buf_gc(), BSTR, buf_printf(), context::c2, check_debug_level(), multi_instance::context, D_DCO_DEBUG, dco_enabled(), gc, buffer::len, mroute_addr_print(), MULTI_PREFIX_MAX_LENGTH, context::options, multi_instance::real, tls_multi::rx_peer_id, tls_common_name(), and context_2::tls_multi.
Referenced by generate_prefix(), multi_add_iroutes(), multi_check_dest_addr_allowed(), multi_client_connect_late_setup(), multi_client_setup_dco_initial(), multi_get_instance_by_virtual_addr(), multi_io_post(), multi_learn_addr(), multi_select_virtual_addr(), multi_unlearn_addr(), and route_quota_exceeded().
|
static |
Definition at line 1010 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, gc_free(), gc_new(), hash_add_fast(), 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_data().
|
static |
Definition at line 1220 of file multi.c.
References mroute_addr::addr, ASSERT, context::c2, multi_instance::context, dco_install_iroute(), mroute_addr::len, management_learn_addr(), context_2::mda_context, MR_ADDR_IPV6, MR_ONLINK_DCO_ADDR, MR_WITH_NETBITS, mroute_addr_mask_host_bits(), multi_check_push_ifconfig_ipv6_extra_route(), multi_learn_addr(), MULTI_ROUTE_PERMANENT, mroute_addr::netbits, mroute_addr::type, and mroute_addr::v6.
Referenced by multi_add_iroutes(), multi_client_connect_late_setup(), and update_vhash().
|
static |
Definition at line 1174 of file multi.c.
References mroute_addr::addr, ASSERT, context::c2, CLEAR, multi_instance::context, dco_install_iroute(), mroute_addr::len, management_learn_addr(), context_2::mda_context, MR_ONLINK_DCO_ADDR, MR_WITH_NETBITS, mroute_extract_openvpn_sockaddr(), multi_check_push_ifconfig_extra_route(), multi_learn_addr(), MULTI_ROUTE_PERMANENT, mroute_addr::netbits, mroute_addr::type, and mroute_addr::v4.
Referenced by multi_add_iroutes(), multi_client_connect_late_setup(), and update_vhash().
|
static |
Definition at line 786 of file multi.c.
References mroute_addr::addr, 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, 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, mroute_addr::len, context_2::link_read_bytes, context_2::link_write_bytes, MAX_PEER_ID, mbuf_maximum_queued(), context_2::mda_context, mroute_addr_print(), msg, MULTI_ROUTE_CACHE, multi_route_defined(), now, context::options, print_in6_addr(), print_in_addr_t(), multi_instance::real, multi_instance::reporting_addr, multi_instance::reporting_addr_ipv6, route, tls_multi::rx_peer_id, 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 3719 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_io_dispatch().
|
static |
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 3161 of file multi.c.
References link_socket_addr::actual, ASSERT, context::c2, man_def_auth_context::cid, multi_context::cid_hash, multi_instance::context, D_MULTI_MEDIUM, context_2::from, gc, gc_free(), gc_new(), generate_prefix(), multi_context::hash, hash_add(), hash_remove(), link_socket::info, mroute_addr::len, context_2::link_socket_infos, context_2::link_sockets, link_socket_info::lsa, MAPF_SHOW_FAMILY, context_2::mda_context, MR_WITH_PROTO, mroute_addr_print_ex(), mroute_extract_openvpn_sockaddr(), msg, multi_check_dest_addr_allowed(), mroute_addr::proto, link_socket_info::proto, multi_instance::real, tls_multi::rx_peer_id, tls_common_name(), context_2::tls_multi, tls_update_remote_addr(), context_2::to_link_addr, multi_context::top, and mroute_addr::type.
Referenced by multi_process_incoming_link_data().
|
static |
Process incoming data packet from clients.
This tries to decrypt and then forward incoming data packets.
Definition at line 3350 of file multi.c.
References ASSERT, BLEN, context_2::buf, context::c1, context::c2, multi_instance::context, D_MULTI_DROPPED, D_VLAN_DEBUG, buffer::data, DEV_TYPE_TAP, DEV_TYPE_TUN, multi_context::enable_c2c, gc, gc_free(), gc_new(), link_socket::info, buffer::len, mroute_addr::len, MR_ADDR_IPV6, MR_ADDR_MASK, mroute_addr_print(), mroute_extract_addr_from_packet(), MROUTE_EXTRACT_BCAST, MROUTE_EXTRACT_MCAST, MROUTE_EXTRACT_SUCCEEDED, msg, multi_bcast(), multi_get_instance_by_virtual_addr(), multi_learn_addr(), multi_process_float(), multi_unicast(), context::options, multi_context::pending, process_incoming_link_part1(), process_incoming_link_part2(), register_activity(), context_2::to_tun, multi_context::top, TUNNEL_TYPE, context_1::tuntap, mroute_addr::vid, vlan_is_tagged(), options::vlan_pvid, and options::vlan_tagging.
Referenced by multi_process_incoming_link().
| void multi_process_per_second_timers_dowork | ( | struct multi_context * | m | ) |
Definition at line 3798 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 2980 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_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_io_dispatch(), 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(), and multi_tcp_process_outgoing_link().
| bool multi_process_signal | ( | struct multi_context * | m | ) |
Definition at line 3880 of file multi.c.
References options::ce, multi_context::deferred_shutdown_signal, connection_entry::explicit_exit_notification, has_udp_in_local_list(), is_exit_restart(), M_INFO, multi_print_status(), multi_push_restart_schedule_exit(), context::options, context::sig, deferred_signal_schedule_entry::signal_received, signal_info::signal_received, signal_reset(), SIGUSR2, 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 3687 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_io_dispatch().
|
static |
Definition at line 3847 of file multi.c.
References ASSERT, context::c2, compute_wakeup_sigma(), multi_instance::context, D_PUSH, multi_context::deferred_shutdown_signal, multi_instance::halt, link_socket::info, multi_context::instances, context_2::link_sockets, multi_context::max_peerid, multi_schedule_context_wakeup(), openvpn_gettimeofday(), link_socket_info::proto, proto_is_dgram(), multi_context::schedule, schedule_add_entry(), send_control_channel_string(), context::sig, deferred_signal_schedule_entry::signal_received, signal_info::signal_received, signal_reset(), multi_context::top, tv_add(), and deferred_signal_schedule_entry::wakeup.
Referenced by multi_process_signal().
|
static |
Definition at line 185 of file multi.c.
References hash_n_buckets(), multi_reap_range(), and multi_context::vhash.
Referenced by multi_uninit().
|
static |
Definition at line 215 of file multi.c.
Referenced by multi_uninit().
|
static |
Definition at line 191 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 202 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 161 of file multi.c.
References multi_route::addr, D_MULTI_DEBUG, dmsg, gc, gc_free(), gc_new(), hash_iterator_delete_element(), hash_iterator_free(), hash_iterator_init_range(), hash_iterator_next(), 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 2938 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 1401 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, 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(), and multi_client_connect_post_plugin().
|
static |
Definition at line 1542 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 3231 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().
|
static |
Definition at line 3834 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().
|
static |
Definition at line 3827 of file multi.c.
References context_2::buffers, context::c2, context_2::frame, inherit_context_top(), init_context_buffers(), context::multi, and multi_context::top.
Referenced by tunnel_server().
|
inlinestatic |
Definition at line 2856 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_data().
|
static |
Definition at line 658 of file multi.c.
References multi_context::cid_hash, frequency_limit_free(), multi_context::hash, hash_free(), multi_context::ifconfig_pool, ifconfig_pool_free(), initial_rate_limit_free(), multi_context::initial_rate_limiter, multi_context::instances, multi_context::max_peerid, multi_context::mbuf, mbuf_free(), mroute_helper_free(), multi_close_instance(), multi_context::multi_io, multi_io_free(), multi_reap_all(), multi_reap_free(), multi_context::new_connection_limiter, multi_context::reaper, multi_context::route_helper, multi_context::schedule, schedule_free(), and multi_context::vhash.
Referenced by tunnel_server().
|
static |
Definition at line 4294 of file multi.c.
References multi_route::addr, D_MULTI_LOW, gc, gc_free(), gc_new(), hash_lookup_fast(), hash_remove_by_value(), hash_value(), multi_route::instance, learn_address_script(), mroute_addr_print(), msg, multi_instance_string(), multi_route_del(), hash_element::value, and multi_context::vhash.
Referenced by multi_unlearn_in6_addr(), and multi_unlearn_in_addr_t().
|
static |
| m | The multi_context |
| mi | The multi_instance of the client we are updating |
| a6 | The new IPv6 address |
Definition at line 4347 of file multi.c.
References mroute_addr::addr, CLEAR, mroute_addr::len, MR_ADDR_IPV6, and multi_unlearn_addr().
Referenced by unlearn_ifconfig_ipv6().
|
static |
| m | The multi_context |
| mi | The multi_instance of the client we are updating |
| a | The new IPv4 address in network byte order |
Definition at line 4329 of file multi.c.
References mroute_addr::addr, CLEAR, mroute_addr::len, MR_ADDR_IPV4, and multi_unlearn_addr().
Referenced by unlearn_ifconfig().
|
static |
Overrides the locked username with the username of –override-username.
| mi | the multi instance that should be modified. |
Definition at line 2567 of file multi.c.
References tls_multi::auth_token_initial, context::c2, CLEAR, multi_instance::context, D_MULTI_ERRORS, D_MULTI_LOW, generate_auth_token(), tls_multi::locked_cn, tls_multi::locked_original_username, tls_multi::locked_username, msg, context::options, options::override_username, tls_multi::session, set_common_name(), ssl_verify_username_length(), SSLF_USERNAME_AS_COMMON_NAME, strncpynt(), tls_lock_common_name(), context_2::tls_multi, TM_ACTIVE, and user_pass::username.
Referenced by multi_connection_established().
|
static |
Definition at line 224 of file multi.c.
References constrain_uint(), REAP_DIVISOR, REAP_MAX, and REAP_MIN.
Referenced by multi_init().
| void route_quota_exceeded | ( | const struct multi_instance * | mi | ) |
Definition at line 3741 of file multi.c.
References multi_instance::context, D_ROUTE_QUOTA, gc, 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 75 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 499 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 3787 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 465 of file multi.c.
References multi_instance::msg_prefix, and set_prefix().
Referenced by multi_close_instance(), and multi_get_instance_udp_data().
| void unlearn_ifconfig | ( | struct multi_context * | m, |
| struct multi_instance * | mi | ||
| ) |
Definition at line 4361 of file multi.c.
References context::c2, multi_instance::context, mroute_addr::len, multi_unlearn_in_addr_t(), context_2::push_ifconfig_defined, context_2::push_ifconfig_local, and multi_instance::reporting_addr.
Referenced by send_single_push_update(), and update_vhash().
| void unlearn_ifconfig_ipv6 | ( | struct multi_context * | m, |
| struct multi_instance * | mi | ||
| ) |
Definition at line 4373 of file multi.c.
References context::c2, CLEAR, multi_instance::context, multi_unlearn_in6_addr(), context_2::push_ifconfig_ipv6_defined, context_2::push_ifconfig_ipv6_local, and multi_instance::reporting_addr_ipv6.
Referenced by send_single_push_update(), and update_vhash().
| void update_vhash | ( | struct multi_context * | m, |
| struct multi_instance * | mi, | ||
| const char * | new_ip, | ||
| const char * | new_ipv6 | ||
| ) |
Update the vhash with new IP/IPv6 addresses in the multi_context when a push-update message containing ifconfig/ifconfig-ipv6 options is sent from the server.
| m | The multi_context |
| mi | The multi_instance of the client we are updating |
| new_ip | The new IPv4 address or NULL if no change |
| new_ipv6 | The new IPv6 address or NULL if no change |
Definition at line 4395 of file multi.c.
References context::c2, CLEAR, multi_instance::context, multi_learn_in6_addr(), multi_learn_in_addr_t(), context_2::push_ifconfig_defined, context_2::push_ifconfig_ipv6_defined, context_2::push_ifconfig_ipv6_local, context_2::push_ifconfig_local, multi_instance::reporting_addr, multi_instance::reporting_addr_ipv6, unlearn_ifconfig(), and unlearn_ifconfig_ipv6().
Referenced by send_single_push_update().
|
static |
Definition at line 2552 of file multi.c.
Referenced by multi_connection_established().