Go to the documentation of this file.
44 #define MULTI_PREFIX_MAX_LENGTH 256
129 #ifdef ENABLE_MANAGEMENT
139 #ifdef ENABLE_ASYNC_PUSH
184 #ifdef ENABLE_MANAGEMENT
206 #ifdef ENABLE_ASYNC_PUSH
208 struct hash *inotify_watchers;
233 #define MULTI_ROUTE_CACHE (1<<0)
234 #define MULTI_ROUTE_AGEABLE (1<<1)
287 #define MPP_PRE_SELECT (1<<0)
288 #define MPP_CONDITIONAL_PRE_SELECT (1<<1)
289 #define MPP_CLOSE_ON_SIGNAL (1<<2)
290 #define MPP_RECORD_TOUCH (1<<3)
390 #ifdef ENABLE_ASYNC_PUSH
398 void multi_process_file_closed(
struct multi_context *m,
const unsigned int mpp_flags);
539 #ifdef MULTI_DEBUG_EVENT_LOOP
551 #ifdef MULTI_DEBUG_EVENT_LOOP
566 #define REAP_MAX_WAKEUP 10
567 #define REAP_DIVISOR 256
569 #define REAP_MAX 1024
575 #define MULTI_CACHE_ROUTE_TTL 60
611 struct timeval tv, current;
658 #ifdef MULTI_DEBUG_EVENT_LOOP
659 printf(
"%s -> TUN len=%d\n",
671 #define CLIENT_CONNECT_OPT_MASK (OPT_P_INSTANCE | OPT_P_INHERIT \
672 |OPT_P_PUSH | OPT_P_TIMER | OPT_P_CONFIG \
673 |OPT_P_ECHO | OPT_P_COMP | OPT_P_SOCKFLAGS)
689 #define MULTI_CHECK_SIG(m) EVENT_LOOP_CHECK_SIGNAL(&(m)->top, multi_process_signal, (m))
Server-mode state structure for one single VPN tunnel.
bool multi_process_incoming_dco(struct multi_context *m)
Process an incoming DCO message (from kernel space).
void multi_uninit(struct multi_context *m)
static bool mbuf_defined(const struct mbuf_set *ms)
void route_quota_exceeded(const struct multi_instance *mi)
void multi_process_per_second_timers_dowork(struct multi_context *m)
struct mroute_helper * route_helper
static bool route_quota_test(const struct multi_instance *mi)
struct event_timeout stale_routes_check_et
static void tv_delta(struct timeval *dest, const struct timeval *t1, const struct timeval *t2)
struct multi_reap * reaper
int len
Length in bytes of the actual content within the allocated memory.
bool multi_process_signal(struct multi_context *m)
#define MULTI_ROUTE_AGEABLE
struct that handles all the rate limiting logic for initial responses
void multi_top_init(struct multi_context *m, struct context *top)
Contains all state information for one tunnel.
struct mbuf_set * mbuf
Set of buffers for passing data channel packets between VPN tunnel instances.
struct mroute_addr real
External network address of the remote peer.
static void set_prefix(struct multi_instance *mi)
char * deferred_ret_file
The temporary file name that contains the return status of the client-connect script if it exits with...
void multi_process_float(struct multi_context *m, struct multi_instance *mi)
Handles peer floating.
static struct schedule_entry * schedule_get_earliest_wakeup(struct schedule *s, struct timeval *wakeup)
void multi_close_instance_on_signal(struct multi_context *m, struct multi_instance *mi)
void multi_ifconfig_pool_persist(struct multi_context *m, bool force)
time_t per_second_trigger
void multi_init(struct multi_context *m, struct context *t, bool tcp_mode)
char * config_file
The temporary file name that contains the config directives returned by the client-connect script.
struct schedule * schedule
Detached client connection state.
struct multi_instance * instance
struct frequency_limit * new_connection_limiter
void process_outgoing_tun(struct context *c)
Write a packet to the virtual tun/tap network interface.
bool multi_process_post(struct multi_context *m, struct multi_instance *mi, const unsigned int flags)
Perform postprocessing of a VPN tunnel instance.
unsigned long cid_counter
struct deferred_signal_schedule_entry deferred_shutdown_signal
static void clear_prefix(void)
static void multi_instance_dec_refcount(struct multi_instance *mi)
struct context_2 c2
Level 2 context.
struct multi_instance ** instances
Array of multi_instances.
static void route_quota_inc(struct multi_instance *mi)
struct buffer_list * cc_config
struct context top
Storage structure for process-wide configuration.
void ungenerate_prefix(struct multi_instance *mi)
void multi_add_mbuf(struct multi_context *m, struct multi_instance *mi, struct mbuf_buffer *mb)
void tunnel_server(struct context *top)
Main event loop for OpenVPN in server mode.
static bool multi_process_outgoing_link_dowork(struct multi_context *m, struct multi_instance *mi, const unsigned int mpp_flags)
void vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *mi)
static void multi_instance_inc_refcount(struct multi_instance *mi)
struct options options
Options loaded from command line or configuration file.
struct multi_instance ** mpp_touched
unsigned int cache_generation
struct hash * hash
VPN tunnel instances indexed by real address of the remote peer.
struct in6_addr reporting_addr_ipv6
static void multi_process_per_second_timers(struct multi_context *m)
struct multi_instance * pending
static void msg_set_prefix(const char *prefix)
struct hash * vhash
VPN tunnel instances indexed by virtual address of remote hosts.
bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags)
Wrapper structure for dynamically allocated memory.
void init_management_callback_multi(struct multi_context *m)
struct multi_instance * earliest_wakeup
ifconfig_pool_handle vaddr_handle
static void route_quota_dec(struct multi_instance *mi)
char msg_prefix[MULTI_PREFIX_MAX_LENGTH]
static void multi_set_pending(struct multi_context *m, struct multi_instance *mi)
struct multi_instance * multi_create_instance(struct multi_context *m, const struct mroute_addr *real)
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 ...
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...
Garbage collection arena used to keep track of dynamically allocated memory.
void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown)
Main OpenVPN server state structure.
static bool multi_output_queue_ready(const struct multi_context *m, const struct multi_instance *mi)
void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
client_connect_return
Return values used by the client connect call-back functions.
struct link_socket_actual * hmac_reply_dest
struct context_buffers * context_buffers
struct hash * iter
VPN tunnel instances indexed by real address of the remote peer, optimized for iteration.
unsigned int option_types_found
const char * multi_instance_string(const struct multi_instance *mi, bool null, struct gc_arena *gc)
struct multi_instance * multi_get_queue(struct mbuf_set *ms)
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
static unsigned int mbuf_len(const struct mbuf_set *ms)
static void gc_free(struct gc_arena *a)
unsigned int cache_generation
static bool multi_route_defined(const struct multi_context *m, const struct multi_route *r)
int max_routes_per_client
#define MULTI_ROUTE_CACHE
time_t created
Time at which a VPN tunnel instance was created.
static void multi_route_del(struct multi_route *route)
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.
struct initial_packet_rate_limit * initial_rate_limiter
struct multi_tcp * mtcp
State specific to OpenVPN using TCP as external transport.
static bool multi_process_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
Send a packet over the virtual tun/tap network interface to its locally reachable destination.
struct mbuf_set * tcp_link_out_deferred
#define MULTI_PREFIX_MAX_LENGTH
void multi_print_status(struct multi_context *m, struct status_output *so, const int version)
struct ifconfig_pool * ifconfig_pool
void process_outgoing_link(struct context *c)
Write a packet to the external network interface.
struct context context
The context structure storing state for this VPN tunnel.
void multi_reap_process_dowork(const struct multi_context *m)
static void multi_get_timeout(struct multi_context *m, struct timeval *dest)
void multi_top_free(struct multi_context *m)
static struct multi_instance * multi_process_outgoing_link_pre(struct multi_context *m)
static void multi_reap_process(const struct multi_context *m)