28#ifdef HAVE_SYS_INOTIFY_H
29#include <sys/inotify.h>
30#define INOTIFY_EVENT_BUFFER_SIZE 16384
57#ifdef MULTI_DEBUG_EVENT_LOOP
72#ifdef ENABLE_MANAGEMENT
87 mmap_stats->n_clients = n_clients;
133 if (
plugin_call(plugins, OPENVPN_PLUGIN_LEARN_ADDRESS, &
argv, NULL,
es) != OPENVPN_PLUGIN_FUNC_SUCCESS)
135 msg(
M_WARN,
"WARNING: learn-address plugin call failed");
183 if (start_bucket < 0)
252#ifdef ENABLE_MANAGEMENT
257 const unsigned long *k = (
const unsigned long *)
key;
258 return (uint32_t) *k;
264 const unsigned long *k1 = (
const unsigned long *)
key1;
265 const unsigned long *k2 = (
const unsigned long *)
key2;
271#ifdef ENABLE_ASYNC_PUSH
276int_hash_function(
const void *
key, uint32_t iv)
278 return (
unsigned long)
key;
282int_compare_function(
const void *
key1,
const void *
key2)
284 return (
unsigned long)
key1 == (
unsigned long)
key2;
340#ifdef ENABLE_MANAGEMENT
347#ifdef ENABLE_ASYNC_PUSH
355 int_compare_function);
455 msg(
M_INFO,
"Initializing stale route check timer to run every %i seconds and to removing routes with activity timeout older than %i seconds",
583 msg(
M_WARN,
"WARNING: client-disconnect plugin call failed");
595#ifdef ENABLE_MANAGEMENT
641#ifdef ENABLE_MANAGEMENT
648#ifdef ENABLE_ASYNC_PUSH
649 if (mi->inotify_watch != -1)
651 hash_remove(m->inotify_watchers, (
void *) (
unsigned long)mi->inotify_watch);
652 mi->inotify_watch = -1;
668 mi->did_iroutes =
false;
679#ifdef ENABLE_MANAGEMENT
729#ifdef ENABLE_MANAGEMENT
736#ifdef ENABLE_ASYNC_PUSH
738 m->inotify_watchers = NULL;
805 msg(
D_MULTI_LOW,
"MULTI: unable to add real address [%s] to iterator hash table",
811#ifdef ENABLE_MANAGEMENT
820#ifdef ENABLE_ASYNC_PUSH
821 mi->inotify_watch = -1;
826 msg(
D_MULTI_ERRORS,
"MULTI: signal occurred during client instance initialization");
875 status_printf(so,
"Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
896 status_printf(so,
"Virtual Address,Common Name,Real Address,Last Ref");
907 char flags[2] = {0, 0};
942 status_printf(
so,
"HEADER%cCLIENT_LIST%cCommon Name%cReal Address%cVirtual Address%cVirtual IPv6 Address%cBytes Received%cBytes Sent%cConnected Since%cConnected Since (time_t)%cUsername%cClient ID%cPeer ID%cData Channel Cipher",
943 sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep);
953#ifdef ENABLE_MANAGEMENT
966 sep, (
unsigned int)mi->
created,
968#ifdef ENABLE_MANAGEMENT
980 status_printf(so,
"HEADER%cROUTING_TABLE%cVirtual Address%cCommon Name%cReal Address%cLast Ref%cLast Ref (time_t)",
981 sep, sep, sep, sep, sep, sep);
992 char flags[2] = {0, 0};
1003 sep, (
unsigned int)
route->last_reference);
1023#ifdef PACKET_TRUNCATION_CHECK
1025 status_printf(
so,
"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
1036 m->
top.
c2.n_trunc_tun_read,
1051#ifdef ENABLE_ASYNC_PUSH
1052 if (m->inotify_watchers)
1071 const unsigned int flags)
1096 bool learn_succeeded =
false;
1115 learn_succeeded =
true;
1125 he->
value = newroute;
1132 learn_succeeded =
true;
1143 learn_succeeded ?
"" :
" FAILED",
1147 if (!learn_succeeded)
1183 else if (cidr_routing)
1190 for (
i = 0;
i <
rh->n_net_len; ++
i)
1262#ifdef ENABLE_MANAGEMENT
1302#ifdef ENABLE_MANAGEMENT
1389 if (mi != new_mi && !mi->
halt)
1392 if (cn && !strcmp(cn, new_cn))
1405 msg(
D_MULTI_LOW,
"MULTI: new connection by client '%s' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect.", new_cn);
1491 msg(
M_INFO,
"MULTI_sva: WARNING: if --ifconfig-push is used for IPv4, automatic IPv6 assignment from --ifconfig-ipv6-pool does not work. Use --ifconfig-ipv6-push for IPv6 then." );
1496 in_addr_t local = 0, remote = 0;
1497 struct in6_addr remote_ipv6;
1498 const char *cn = NULL;
1512 msg(
M_INFO,
"MULTI_sva: pool returned IPv4=%s, IPv6=%s",
1518 :
"(Not enabled)") );
1534 if (tunnel_topology ==
TOP_P2P)
1551 "MULTI: no --ifconfig-pool netmask parameter is available to push to %s",
1589 msg(
M_INFO,
"MULTI_sva: push_ifconfig_ipv6 %s/%d",
1613 "ifconfig_pool_remote_ip",
1620 "ifconfig_pool_netmask",
1627 "ifconfig_pool_local_ip",
1640 "ifconfig_pool_remote",
1644 "ifconfig_pool_local",
1648 "ifconfig_pool_ip6_netbits",
1659 const char *dc_file,
1660 unsigned int *option_types_found)
1692 unsigned int *option_types_found)
1702 for (i = 0; i < config.
n; ++i)
1704 if (config.
list[i] && config.
list[i]->value)
1707 config.
list[i]->value,
1736 unsigned int *option_types_found)
1741#ifdef ENABLE_MANAGEMENT
1747 const char *opt =
BSTR(&be->
buf);
1817 msg(
M_INFO,
"Client does not support DATA_V2. Data channel offloading "
1818 "requires DATA_V2. Dropping client.");
1820 "failed (missing DATA_V2)");
1828 msg(
M_WARN,
"Note: peer reports running in P2P mode (no --pull/--client "
1829 "option). It will not negotiate ciphers with this server. "
1830 "Expect this connection to fail.");
1838#ifdef HAVE_EXPORT_KEYING_MATERIAL
1845 msg(
M_INFO,
"PUSH: client does not support TLS Keying Material "
1846 "Exporters but --force-tls-key-material-export is enabled.");
1848 "server. Keying Material Exporters (RFC 5705) "
1849 "support missing. Upgrade to a client that "
1850 "supports this feature (OpenVPN 2.6.0+).");
1872 msg(
M_INFO,
"PUSH: client wants to negotiate cipher (NCP), but "
1873 "server has already generated data channel keys, "
1874 "re-sending previously negotiated cipher '%s'",
1909 if (strlen(peer_ciphers) > 0)
1911 msg(
M_INFO,
"PUSH: No common cipher between server and client. "
1912 "Server data-ciphers: '%s'%s, client supported ciphers '%s'",
1917 msg(
M_INFO,
"PUSH: No common cipher between server and client. "
1918 "Server data-ciphers: '%s'%s, client supports cipher '%s'",
1924 msg(
M_INFO,
"PUSH: No NCP or OCC cipher data received from peer.");
1928 msg(
M_INFO,
"Using data channel cipher '%s' since "
1929 "--data-ciphers-fallback is set.", o->
ciphername);
1934 msg(
M_INFO,
"Use --data-ciphers-fallback with the cipher the "
1935 "client is using if you want to allow the client to connect");
1941 "failed (no shared cipher)");
2022 const int c = fgetc(fp);
2047 msg(
M_WARN,
"WARNING: Unknown/unexpected value in deferred "
2048 "client-connect resultfile");
2116 unsigned int *option_types_found)
2122 ASSERT(option_types_found);
2133 call = OPENVPN_PLUGIN_CLIENT_CONNECT;
2143 call = OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER;
2152 if (plug_ret == OPENVPN_PLUGIN_FUNC_SUCCESS)
2156 else if (plug_ret == OPENVPN_PLUGIN_FUNC_DEFERRED)
2167 msg(
M_WARN,
"WARNING: client-connect plugin call failed");
2192 option_types_found);
2211 unsigned int *option_types_found)
2217 ASSERT(option_types_found);
2219 int call = deferred ? OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2 :
2220 OPENVPN_PLUGIN_CLIENT_CONNECT_V2;
2230 if (plug_ret == OPENVPN_PLUGIN_FUNC_SUCCESS)
2235 else if (plug_ret == OPENVPN_PLUGIN_FUNC_DEFERRED)
2239 OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2)))
2241 msg(
M_WARN,
"A plugin that defers from the "
2242 "OPENVPN_PLUGIN_CLIENT_CONNECT_V2 call must also "
2243 "declare support for "
2244 "OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2");
2250 msg(
M_WARN,
"WARNING: client-connect-v2 plugin call failed");
2264 unsigned int *option_types_found)
2267 ASSERT(option_types_found);
2294 msg(
M_INFO,
"MULTI: deferred --client-connect script returned CC_RET_FAILED");
2346 option_types_found);
2379 msg(
D_DCO,
"Cannot add peer to DCO for %s: %s (%d)",
2393 struct frame *frame_fragment = NULL;
2394#ifdef ENABLE_FRAGMENT
2417 const unsigned int option_types_found)
2434 "--ifconfig address is available for %s",
2443 const char *ifconfig_constraint_network =
2445 const char *ifconfig_constraint_netmask =
2450 "violates tunnel network/netmask constraint (%s/%s)",
2453 ifconfig_constraint_network, ifconfig_constraint_netmask);
2507 const char *ifconfig_local_ipv6 =
2511 ifconfig_local_ipv6);
2528 "only works with tun-style tunnels",
2580 unsigned int *option_types_found)
2588 if (peer_info && strstr(peer_info,
"IV_COMP_STUBv2=1"))
2614 unsigned int *option_types_found)
2623 const char *ccd_file = NULL;
2625 const char *ccd_client =
2630 const char *ccd_default =
2638 ccd_file = ccd_client;
2643 ccd_file = ccd_default;
2671 bool from_deferred,
unsigned int *option_types_found);
2710 unsigned int *option_types_found =
2716 *cur_handler_index = 0;
2717 *option_types_found = 0;
2724 bool cc_succeeded =
true;
2731 option_types_found);
2733 from_deferred =
false;
2765 cc_succeeded =
false;
2776 if (mi->context.options.disable)
2779 "'disable' directive");
2780 cc_succeeded =
false;
2783 (*cur_handler_index)++;
2790 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to incompatible DCO options");
2791 cc_succeeded =
false;
2796 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to invalid compression options");
2797 cc_succeeded =
false;
2821#ifdef ENABLE_MANAGEMENT
2830#ifdef ENABLE_ASYNC_PUSH
2838multi_process_file_closed(
struct multi_context *m,
const unsigned int mpp_flags)
2840 char buffer[INOTIFY_EVENT_BUFFER_SIZE];
2841 size_t buffer_i = 0;
2842 int r =
read(m->
top.
c2.inotify_fd,
buffer, INOTIFY_EVENT_BUFFER_SIZE);
2844 while (buffer_i < r)
2847 struct inotify_event *pevent = (
struct inotify_event *) &
buffer[buffer_i];
2848 size_t event_size =
sizeof(
struct inotify_event) + pevent->len;
2849 buffer_i += event_size;
2851 msg(
D_MULTI_DEBUG,
"MULTI: modified fd %d, mask %d", pevent->wd, pevent->mask);
2855 if (pevent->mask & IN_CLOSE_WRITE)
2867 else if (pevent->mask & IN_IGNORED)
2872 hash_remove(m->inotify_watchers, (
void *) (
unsigned long) pevent->wd);
2873 mi->inotify_watch = -1;
2902 msg(
D_MULTI_DROPPED,
"MULTI: packet dropped due to output saturation (multi_add_mbuf)");
2911 const struct buffer *buf,
2942#ifdef MULTI_DEBUG_EVENT_LOOP
2943 printf(
"BCAST len=%d\n",
BLEN(
buf));
2951 if (mi != sender_instance && !mi->
halt)
2978static inline unsigned int
2981 if (delta->tv_sec < 1)
2984 return delta->tv_usec >> 3;
2989 if (delta->tv_sec < 600)
2991 return delta->tv_sec << 17;
3014#if defined(ENABLE_ASYNC_PUSH)
3017 int inotify_fd,
const char *file)
3020 long watch_descriptor = inotify_add_watch(inotify_fd, file,
3021 IN_CLOSE_WRITE | IN_ONESHOT);
3022 if (watch_descriptor >= 0)
3024 if (mi->inotify_watch != -1)
3027 (
void *) (
unsigned long)mi->inotify_watch);
3029 hash_add(m->inotify_watchers, (
const uintptr_t *)watch_descriptor,
3031 mi->inotify_watch = watch_descriptor;
3054#if defined(ENABLE_ASYNC_PUSH)
3055 bool was_unauthenticated =
true;
3068#if defined(ENABLE_ASYNC_PUSH)
3077 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3083 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3097#if defined(ENABLE_ASYNC_PUSH)
3101 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3124#ifdef MULTI_DEBUG_EVENT_LOOP
3125 printf(
"POST %s[%d] to=%d lo=%d/%d w=%" PRIi64
"/%ld\n",
3172 msg(
D_MULTI_LOW,
"Disallow float to an address taken by another client %s",
3210#ifdef ENABLE_MANAGEMENT
3232#if (defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))) || defined(ENABLE_MANAGEMENT)
3241#if defined(ENABLE_DCO) \
3242 && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32))
3247 const char *reason =
"ovpn-dco: unknown reason";
3248 switch (
dco->dco_del_peer_reason)
3251 reason =
"ovpn-dco: ping expired";
3255 reason =
"ovpn-dco: transport error";
3259 reason =
"ovpn-dco: transport disconnected";
3296 int peer_id = dco->dco_message_peer_id;
3306 if ((peer_id < m->max_clients) && (m->
instances[peer_id]))
3311 process_incoming_del_peer(m, mi, dco);
3320 int msglevel =
D_DCO;
3333 msg(msglevel,
"Received DCO message for unknown peer-id: %d, "
3334 "type %d, del_peer_reason %d", peer_id, dco->dco_message_type,
3335 dco->dco_del_peer_reason);
3338 dco->dco_message_type = 0;
3339 dco->dco_message_peer_id = -1;
3340 dco->dco_del_peer_reason = -1;
3341 dco->dco_read_bytes = 0;
3342 dco->dco_write_bytes = 0;
3353 const unsigned int mpp_flags,
struct link_socket *sock)
3362 bool floated =
false;
3371#ifdef MULTI_DEBUG_EVENT_LOOP
3403 const uint8_t *orig_buf;
3441 && IN6_IS_ADDR_LINKLOCAL(&src.
v6.
addr) )
3562 unsigned int mroute_flags;
3567#ifdef MULTI_DEBUG_EVENT_LOOP
3568 printf(
"TUN -> TCP/UDP [%d]\n",
BLEN(&
m->top.c2.buf));
3576 if (dev_type ==
DEV_TYPE_TAP &&
m->top.options.vlan_tagging)
3626 msg(
D_MULTI_DROPPED,
"MULTI: packet dropped due to output saturation (multi_process_incoming_tun)");
3689#ifdef MULTI_DEBUG_EVENT_LOOP
3741 msg(
D_ROUTE_QUOTA,
"MULTI ROUTE: route quota (%d) exceeded for %s (see --max-routes-per-client option)",
3754 const int level = GREMLIN_PACKET_FLOOD_LEVEL(m->
top.
options.gremlin);
3759 struct packet_flood_parms parm = get_packet_flood_parms(level);
3765 msg(
D_GREMLIN,
"GREMLIN_FLOOD_CLIENTS: flooding clients with %d packets of size %d",
3769 for (i = 0; i < parm.packet_size; ++i)
3774 for (i = 0; i < parm.n_packets; ++i)
3787 struct timeval null;
3814 gremlin_flood_clients(m);
3841 return (sig == SIGUSR1 || sig == SIGTERM || sig == SIGHUP || sig == SIGINT);
3908#ifdef ENABLE_MANAGEMENT
3947 if (cn && !strcmp(cn, del_cn))
3960 const int port,
const int proto)
4007 if (mi && !mi->
halt)
4034 const unsigned long cid,
4035 const unsigned int mda_key_id,
4037 unsigned int timeout)
4073 const unsigned long cid,
4074 const unsigned int mda_key_id,
4077 const char *client_reason,
4082 bool cc_config_owned =
true;
4095 cc_config_owned =
false;
4100 msg(
D_MULTI_LOW,
"MULTI: connection rejected: %s, CLI:%s", reason,
np(client_reason));
4132#ifdef ENABLE_MANAGEMENT
4247#ifdef ENABLE_ASYNC_PUSH
4248 multi.
top.
c2.inotify_fd = inotify_init();
4249 if (multi.
top.
c2.inotify_fd < 0)
4257 #ifdef ENABLE_ASYNC_PUSH
4258 close(
top->
c2.inotify_fd);
void argv_parse_cmd(struct argv *argres, const char *cmdstr)
Parses a command string, tokenizes it and puts each element into a separate struct argv argument slot...
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
bool argv_printf(struct argv *argres, const char *format,...)
printf() variant which populates a struct argv.
bool argv_printf_cat(struct argv *argres, const char *format,...)
printf() inspired argv concatenation.
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
bool buf_printf(struct buffer *buf, const char *format,...)
void buffer_list_free(struct buffer_list *ol)
Frees a buffer list and all the buffers in it.
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
char * string_alloc(const char *str, struct gc_arena *gc)
#define ALLOC_OBJ(dptr, type)
static void buf_reset(struct buffer *buf)
static bool buf_write_u8(struct buffer *dest, uint8_t data)
static void buf_reset_len(struct buffer *buf)
static void strncpynt(char *dest, const char *src, size_t maxlen)
static void gc_free(struct gc_arena *a)
#define ALLOC_OBJ_CLEAR(dptr, type)
#define buf_init(buf, offset)
static struct gc_arena gc_new(void)
static const char *const key1
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
long int get_random(void)
const char * translate_cipher_name_to_openvpn(const char *cipher_name)
Translate a crypto library cipher name to an OpenVPN cipher name.
#define CO_USE_TLS_KEY_MATERIAL_EXPORT
Bit-flag indicating that data channel key derivation is done using TLS keying material export [RFC570...
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
#define CO_EPOCH_DATA_KEY_FORMAT
Bit-flag indicating the epoch the data format.
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
Data Channel Cryptography SSL library-specific backend interface.
bool cipher_kt_mode_aead(const char *ciphername)
Check if the supplied cipher is a supported AEAD mode cipher.
static int dco_do_read(dco_context_t *dco)
static int dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m, const bool raise_sigusr1_on_err)
static void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, struct mroute_addr *addr)
static bool dco_check_option(int msglevel, const struct options *o)
static int dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
static void dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi)
void setenv_counter(struct env_set *es, const char *name, counter_type value)
void setenv_int(struct env_set *es, const char *name, int value)
void setenv_str(struct env_set *es, const char *name, const char *value)
struct env_set * env_set_create(struct gc_arena *gc)
void setenv_long_long(struct env_set *es, const char *name, long long value)
void setenv_del(struct env_set *es, const char *name)
@ EVENT_ARG_MULTI_INSTANCE
void reschedule_multi_process(struct context *c)
Reschedule tls_multi_process.
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
void pre_select(struct context *c)
void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock)
Interface functions to the internal and external multiplexers.
#define PIPV6_ICMP_NOHOST_SERVER
static struct link_socket_info * get_link_socket_info(struct context *c)
static void register_activity(struct context *c, const int size)
#define TM_INITIAL
As yet un-trusted tls_session being negotiated.
#define KS_PRIMARY
Primary key state index.
#define TM_ACTIVE
Active tls_session.
void encrypt_sign(struct context *c, bool comp_frag)
Process a data channel packet that will be sent through a VPN tunnel.
void tunnel_server(struct context *top)
Main event loop for OpenVPN in server mode.
static void tunnel_server_loop(struct multi_context *multi)
Main event loop for OpenVPN in point-to-multipoint server mode.
bool process_incoming_link_part1(struct context *c, struct link_socket_info *lsi, bool floated)
Starts processing a packet read from the external network interface.
void process_incoming_link_part2(struct context *c, struct link_socket_info *lsi, const uint8_t *orig_buf)
Continues processing a packet read from the external network interface.
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.
struct multi_instance * multi_get_create_instance_udp(struct multi_context *m, bool *floated, struct link_socket *sock)
Get, and if necessary create, the multi_instance associated with a packet's source address.
void process_incoming_tun(struct context *c, struct link_socket *out_sock)
Process a packet read from the virtual tun/tap 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 ...
void uninit_management_callback(void)
void initialization_sequence_completed(struct context *c, const unsigned int flags)
void close_instance(struct context *c)
void inherit_context_top(struct context *dest, const struct context *src)
void free_context_buffers(struct context_buffers *b)
void init_instance_handle_signals(struct context *c, const struct env_set *env, const unsigned int flags)
void inherit_context_child(struct context *dest, const struct context *src, struct link_socket *sock)
void context_clear_2(struct context *c)
void close_context(struct context *c, int sig, unsigned int flags)
void management_show_net_callback(void *arg, const int msglevel)
struct context_buffers * init_context_buffers(const struct frame *frame)
bool do_deferred_options(struct context *c, const unsigned int found)
#define CC_HARD_USR1_TO_HUP
static int min_int(int x, int y)
static int constrain_int(int x, int min, int max)
static SERVICE_STATUS status
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
This is the principal function for testing and triggering recurring timers.
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
void hash_iterator_free(struct hash_iterator *hi)
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
void hash_iterator_delete_element(struct hash_iterator *hi)
struct hash_element * hash_lookup_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
struct hash * hash_init(const int n_buckets, const uint32_t iv, uint32_t(*hash_function)(const void *key, uint32_t iv), bool(*compare_function)(const void *key1, const void *key2))
void hash_iterator_init_range(struct hash *hash, struct hash_iterator *hi, int start_bucket, int end_bucket)
void hash_free(struct hash *hash)
bool hash_add(struct hash *hash, const void *key, void *value, bool replace)
static bool hash_remove(struct hash *hash, const void *key)
static void * hash_lookup(struct hash *hash, const void *key)
static int hash_n_elements(const struct hash *hash)
static uint32_t hash_value(const struct hash *hash, const void *key)
static int hash_n_buckets(const struct hash *hash)
static void hash_add_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv, void *value)
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
void management_learn_addr(struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
void management_connection_established(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
void management_set_callback(struct management *man, const struct management_callback *cb)
void mbuf_add_item(struct mbuf_set *ms, const struct mbuf_item *item)
struct mbuf_buffer * mbuf_alloc_buf(const struct buffer *buf)
void mbuf_free_buf(struct mbuf_buffer *mb)
void mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance *mi)
bool mbuf_extract_item(struct mbuf_set *ms, struct mbuf_item *item)
void mbuf_free(struct mbuf_set *ms)
struct mbuf_set * mbuf_init(unsigned int size)
static int mbuf_maximum_queued(const struct mbuf_set *ms)
void mroute_addr_mask_host_bits(struct mroute_addr *ma)
void mroute_helper_add_iroute46(struct mroute_helper *mh, int netbits)
bool mroute_extract_openvpn_sockaddr(struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port)
const char * mroute_addr_print(const struct mroute_addr *ma, struct gc_arena *gc)
uint32_t mroute_addr_hash_function(const void *key, uint32_t iv)
void mroute_helper_del_iroute46(struct mroute_helper *mh, int netbits)
bool mroute_learnable_address(const struct mroute_addr *addr, struct gc_arena *gc)
bool mroute_addr_compare_function(const void *key1, const void *key2)
struct mroute_helper * mroute_helper_init(int ageable_ttl_secs)
void mroute_addr_init(struct mroute_addr *addr)
void mroute_helper_free(struct mroute_helper *mh)
#define MROUTE_EXTRACT_SUCCEEDED
#define MROUTE_EXTRACT_MCAST
static unsigned int mroute_extract_addr_from_packet(struct mroute_addr *src, struct mroute_addr *dest, uint16_t vid, const struct buffer *buf, int tunnel_type)
static void mroute_extract_in_addr_t(struct mroute_addr *dest, const in_addr_t src)
static bool mroute_addr_equal(const struct mroute_addr *a1, const struct mroute_addr *a2)
#define MROUTE_EXTRACT_BCAST
void multi_tcp_instance_specific_free(struct multi_instance *mi)
void multi_tcp_delete_event(struct multi_io *multi_io, event_t event)
bool multi_tcp_instance_specific_init(struct multi_context *m, struct multi_instance *mi)
void multi_tcp_dereference_instance(struct multi_io *multi_io, struct multi_instance *mi)
static const char * np(const char *str)
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 void multi_schedule_context_wakeup(struct multi_context *m, struct multi_instance *mi)
static void multi_client_connect_early_setup(struct multi_context *m, struct multi_instance *mi)
static void multi_reap_free(struct multi_reap *mr)
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_de...
static struct multi_reap * multi_reap_new(int buckets_per_pass)
struct multi_instance * multi_create_instance(struct multi_context *m, const struct mroute_addr *real, struct link_socket *sock)
static void multi_add_iroutes(struct multi_context *m, struct multi_instance *mi)
void multi_ifconfig_pool_persist(struct multi_context *m, bool force)
static void multi_signal_instance(struct multi_context *m, struct multi_instance *mi, const int sig)
void multi_reap_process_dowork(const struct multi_context *m)
static int management_callback_n_clients(void *arg)
bool multi_process_signal(struct multi_context *m)
static void multi_select_virtual_addr(struct multi_context *m, struct multi_instance *mi)
void multi_init(struct multi_context *m, struct context *t)
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.
void multi_close_instance_on_signal(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 void multi_connection_established(struct multi_context *m, struct multi_instance *mi)
void multi_process_per_second_timers_dowork(struct multi_context *m)
static void multi_set_virtual_addr_env(struct multi_instance *mi)
static void multi_client_connect_setenv(struct multi_instance *mi)
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_float(struct multi_context *m, struct multi_instance *mi, struct link_socket *sock)
Handles peer floating.
static int management_callback_kill_by_cn(void *arg, const char *del_cn)
static bool stale_route_check_trigger(struct multi_context *m)
static bool management_kill_by_cid(void *arg, const unsigned long cid, const char *kill_msg)
static void generate_prefix(struct multi_instance *mi)
static void multi_del_iroutes(struct multi_context *m, struct multi_instance *mi)
static void management_delete_event(void *arg, event_t event)
static bool multi_client_setup_dco_initial(struct multi_context *m, struct multi_instance *mi, struct gc_arena *gc)
static struct multi_instance * lookup_by_cid(struct multi_context *m, const unsigned long cid)
const char * multi_instance_string(const struct multi_instance *mi, bool null, struct gc_arena *gc)
static void multi_client_connect_late_setup(struct multi_context *m, struct multi_instance *mi, const unsigned int option_types_found)
static unsigned int compute_wakeup_sigma(const struct timeval *delta)
static bool learn_address_script(const struct multi_context *m, const struct multi_instance *mi, const char *op, const struct mroute_addr *addr)
static void multi_unicast(struct multi_context *m, const struct buffer *buf, struct multi_instance *mi)
void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown)
static bool management_client_pending_auth(void *arg, const unsigned long cid, const unsigned int mda_key_id, const char *extra, unsigned int timeout)
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 void multi_push_restart_schedule_exit(struct multi_context *m, bool next_server)
static void multi_client_disconnect_script(struct multi_context *m, struct multi_instance *mi)
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 c...
static void check_stale_routes(struct multi_context *m)
static int management_callback_kill_by_addr(void *arg, const in_addr_t addr, const int port, const int proto)
static void multi_reap_range(const struct multi_context *m, int start_bucket, int end_bucket)
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 void multi_bcast(struct multi_context *m, const struct buffer *buf, const struct multi_instance *sender_instance, uint16_t vid)
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.
static void multi_reap_all(const struct multi_context *m)
void multi_add_mbuf(struct multi_context *m, struct multi_instance *mi, struct mbuf_buffer *mb)
static int reap_buckets_per_pass(int n_buckets)
void route_quota_exceeded(const struct multi_instance *mi)
void ungenerate_prefix(struct multi_instance *mi)
void multi_top_free(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...
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_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.
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 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_delete_dup(struct multi_context *m, struct multi_instance *new_mi)
static struct multi_instance * multi_get_instance_by_virtual_addr(struct multi_context *m, const struct mroute_addr *addr, bool cidr_routing)
void multi_top_init(struct multi_context *m, struct context *top)
void init_management_callback_multi(struct multi_context *m)
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 char * management_get_peer_info(void *arg, const unsigned long cid)
static enum client_connect_return multi_client_connect_script_deferred(struct multi_context *m, struct multi_instance *mi, unsigned int *option_types_found)
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 pe...
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)
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 bool is_exit_restart(int sig)
static bool ifconfig_push_constraint_satisfied(const struct context *c)
static void set_cc_config(struct multi_instance *mi, struct buffer_list *cc_config)
void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
static bool cid_compare_function(const void *key1, const void *key2)
enum client_connect_return multi_client_connect_mda(struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found)
static bool multi_client_generate_tls_keys(struct context *c)
Generates the data channel keys.
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 setenv_stats(struct multi_context *m, struct context *c)
static uint32_t cid_hash_function(const void *key, uint32_t iv)
static void management_callback_status(void *arg, const int version, struct status_output *so)
static void update_mstat_n_clients(const int n_clients)
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...
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_conne...
void multi_print_status(struct multi_context *m, struct status_output *so, const int version)
static const multi_client_connect_handler client_connect_handlers[]
void multi_uninit(struct multi_context *m)
static void multi_client_disconnect_setenv(struct multi_context *m, struct multi_instance *mi)
Header file for server-mode related structures and functions.
bool multi_process_incoming_dco(struct multi_context *m)
Process an incoming DCO message (from kernel space).
#define MPP_CONDITIONAL_PRE_SELECT
client_connect_return
Return values used by the client connect call-back functions.
static bool multi_output_queue_ready(const struct multi_context *m, const struct multi_instance *mi)
#define MULTI_PREFIX_MAX_LENGTH
#define MULTI_CHECK_SIG(m)
static void set_prefix(struct multi_instance *mi)
static void multi_route_del(struct multi_route *route)
static void multi_reap_process(const struct multi_context *m)
static void route_quota_inc(struct multi_instance *mi)
#define MULTI_ROUTE_CACHE
static void clear_prefix(void)
static bool multi_route_defined(const struct multi_context *m, const struct multi_route *r)
#define MULTI_CACHE_ROUTE_TTL
#define MPP_CLOSE_ON_SIGNAL
static void multi_instance_dec_refcount(struct multi_instance *mi)
static void multi_instance_inc_refcount(struct multi_instance *mi)
static void multi_get_timeout(struct multi_context *m, struct timeval *dest)
#define CLIENT_CONNECT_OPT_MASK
static void multi_set_pending(struct multi_context *m, struct multi_instance *mi)
#define MULTI_ROUTE_AGEABLE
static void multi_process_per_second_timers(struct multi_context *m)
static bool route_quota_test(const struct multi_instance *mi)
void multi_io_process_io(struct multi_context *m)
struct multi_io * multi_io_init(int maxevents, int *maxclients)
void multi_io_free(struct multi_io *multi_io)
int multi_io_wait(struct multi_context *m)
void multi_io_action(struct multi_context *m, struct multi_instance *mi, int action, bool poll)
static bool check_debug_level(unsigned int level)
static bool is_cas_pending(enum multi_status cas)
void options_server_import(struct options *o, const char *filename, int msglevel, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void options_string_import(struct options *options, const char *config, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
const char title_string[]
bool has_udp_in_local_list(const struct options *options)
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
const char * time_string(time_t t, long usec, bool show_usec, struct gc_arena *gc)
struct frequency_limit * frequency_limit_init(int max, int per)
void frequency_limit_free(struct frequency_limit *f)
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
static void tv_add(struct timeval *dest, const struct timeval *src)
@ OVPN_CMD_DEL_PEER
@OVPN_CMD_DEL_PEER: Remove peer from internal table
@ OVPN_DEL_PEER_REASON_EXPIRED
@ OVPN_DEL_PEER_REASON_TRANSPORT_DISCONNECT
@ OVPN_DEL_PEER_REASON_TRANSPORT_ERROR
@ OVPN_DEL_PEER_REASON_USERSPACE
static void perf_push(int type)
#define PERF_MULTI_CLOSE_INSTANCE
#define PERF_PROC_IN_LINK
static void perf_pop(void)
#define PERF_MULTI_CREATE_INSTANCE
void plugin_return_free(struct plugin_return *pr)
void plugin_return_get_column(const struct plugin_return *src, struct plugin_return *dest, const char *colname)
bool plugin_defined(const struct plugin_list *pl, const int type)
static void plugin_return_init(struct plugin_return *pr)
static int plugin_call(const struct plugin_list *pl, const int type, const struct argv *av, struct plugin_return *pr, struct env_set *es)
static bool plugin_return_defined(const struct plugin_return *pr)
ifconfig_pool_handle ifconfig_pool_acquire(struct ifconfig_pool *pool, in_addr_t *local, in_addr_t *remote, struct in6_addr *remote_ipv6, const char *common_name)
bool ifconfig_pool_release(struct ifconfig_pool *pool, ifconfig_pool_handle hand, const bool hard)
void ifconfig_pool_write(struct ifconfig_pool_persist *persist, const struct ifconfig_pool *pool)
bool ifconfig_pool_write_trigger(struct ifconfig_pool_persist *persist)
void ifconfig_pool_free(struct ifconfig_pool *pool)
void ifconfig_pool_read(struct ifconfig_pool_persist *persist, struct ifconfig_pool *pool)
struct ifconfig_pool * ifconfig_pool_init(const bool ipv4_pool, enum pool_type type, in_addr_t start, in_addr_t end, const bool duplicate_cn, const bool ipv6_pool, const struct in6_addr ipv6_base, const int ipv6_netbits)
int process_incoming_push_request(struct context *c)
void send_restart(struct context *c, const char *kill_msg)
void push_option(struct options *o, const char *opt, int msglevel)
bool send_auth_pending_messages(struct tls_multi *tls_multi, struct tls_session *session, const char *extra, unsigned int timeout)
Sends the auth pending control messages to a client.
void remove_iroutes_from_push_route_list(struct options *o)
void initial_rate_limit_free(struct initial_packet_rate_limit *irl)
free the initial-packet rate limiter structure
struct initial_packet_rate_limit * initial_rate_limit_init(int max_per_period, int period_length)
allocate and initialize the initial-packet rate limiter structure
static int openvpn_run_script(const struct argv *a, const struct env_set *es, const unsigned int flags, const char *hook)
Will run a script and return the exit code of the script if between 0 and 255, -1 otherwise.
void schedule_remove_entry(struct schedule *s, struct schedule_entry *e)
struct schedule * schedule_init(void)
void schedule_free(struct schedule *s)
static void schedule_add_entry(struct schedule *s, struct schedule_entry *e, const struct timeval *tv, unsigned int sigma)
int signal_reset(struct signal_info *si, int signum)
Clear the signal if its current value equals signum.
void remap_signal(struct context *c)
void throw_signal(const int signum)
Throw a hard signal.
void register_signal(struct signal_info *si, int signum, const char *signal_text)
Register a soft signal in the signal_info struct si respecting priority.
void print_signal(const struct signal_info *si, const char *title, int msglevel)
void setenv_in_addr_t(struct env_set *es, const char *name_prefix, in_addr_t addr, const unsigned int flags)
void setenv_in6_addr(struct env_set *es, const char *name_prefix, const struct in6_addr *addr, const unsigned int flags)
const char * print_link_socket_actual(const struct link_socket_actual *act, struct gc_arena *gc)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
void setenv_trusted(struct env_set *es, const struct link_socket_info *info)
#define IA_EMPTY_IF_UNDEF
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
#define SA_SET_IF_NONZERO
void tls_update_remote_addr(struct tls_multi *multi, const struct link_socket_actual *addr)
Updates remote address in TLS sessions.
void tls_session_soft_reset(struct tls_multi *tls_multi)
bool tls_session_update_crypto_params(struct tls_multi *multi, struct tls_session *session, struct options *options, struct frame *frame, struct frame *frame_fragment, struct link_socket_info *lsi, dco_context_t *dco)
Update TLS session crypto parameters (cipher and auth) and derive data channel keys based on the supp...
#define IV_PROTO_CC_EXIT_NOTIFY
Support for explicit exit notify via control channel This also includes support for the protocol-flag...
#define IV_PROTO_DATA_EPOCH
Support the extended packet id and epoch format for data channel packets.
#define IV_PROTO_DATA_V2
Support P_DATA_V2.
#define IV_PROTO_TLS_KEY_EXPORT
Supports key derivation via TLS key material exporter [RFC5705].
#define IV_PROTO_DYN_TLS_CRYPT
Support to dynamic tls-crypt (renegotiation with TLS-EKM derived tls-crypt key)
#define IV_PROTO_REQUEST_PUSH
Assume client will send a push request and server does not need to wait for a push-request to send a ...
#define IV_PROTO_NCP_P2P
Support doing NCP in P2P mode.
@ CAS_PENDING_DEFERRED
Waiting on an async option import handler.
@ CAS_WAITING_AUTH
Initial TLS connection established but deferred auth is not yet finished.
@ CAS_PENDING_DEFERRED_PARTIAL
at least handler succeeded but another is still pending
@ CAS_PENDING
Options import (Connect script/plugin, ccd,...)
@ CAS_FAILED
Option import failed or explicitly denied the client.
@ KS_AUTH_FALSE
Key state is not authenticated
@ KS_AUTH_DEFERRED
Key state authentication is being deferred, by async auth.
static const struct key_state * get_primary_key(const struct tls_multi *multi)
gets an item of key_state objects in the order they should be scanned by data channel modules.
char * ncp_get_best_cipher(const char *server_list, const char *peer_info, const char *remote_cipher, struct gc_arena *gc)
Iterates through the ciphers in server_list and return the first cipher that is also supported by the...
const char * tls_peer_ncp_list(const char *peer_info, struct gc_arena *gc)
Returns the support cipher list from the peer according to the IV_NCP and IV_CIPHER values in peer_in...
const char * ncp_expanded_ciphers(struct options *o, struct gc_arena *gc)
returns the o->ncp_ciphers in brackets, e.g.
Control Channel SSL/Data dynamic negotiation Module This file is split from ssl.h to be able to unit ...
unsigned int extract_iv_proto(const char *peer_info)
Extracts the IV_PROTO variable and returns its value or 0 if it cannot be extracted.
bool tls_authenticate_key(struct tls_multi *multi, const unsigned int mda_key_id, const bool auth, const char *client_reason)
bool cert_hash_compare(const struct cert_hash_set *chs1, const struct cert_hash_set *chs2)
Compares certificates hashes, returns true if hashes are equal.
void tls_lock_cert_hash_set(struct tls_multi *multi)
Locks the certificate hash set used in the given tunnel.
void tls_lock_common_name(struct tls_multi *multi)
Locks the common name field for the given tunnel.
const char * tls_username(const struct tls_multi *multi, const bool null)
Returns the username field for the given tunnel.
void auth_set_client_reason(struct tls_multi *multi, const char *client_reason)
Sets the reason why authentication of a client failed.
const char * tls_common_name(const struct tls_multi *multi, const bool null)
Returns the common name field for the given tunnel.
Control Channel Verification Module.
bool status_trigger(struct status_output *so)
void status_printf(struct status_output *so, const char *format,...)
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
void status_flush(struct status_output *so)
void status_reset(struct status_output *so)
bool status_close(struct status_output *so)
struct buffer_entry * next
struct buffer_entry * head
Wrapper structure for dynamically allocated memory.
uint8_t * data
Pointer to the allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Detached client connection state.
char * config_file
The temporary file name that contains the config directives returned by the client-connect script.
unsigned int option_types_found
char * deferred_ret_file
The temporary file name that contains the return status of the client-connect script if it exits with...
int explicit_exit_notification
struct ifconfig_pool_persist * ifconfig_pool_persist
struct status_output * status_output
struct tuntap * tuntap
Tun/tap virtual network interface.
bool push_request_received
counter_type link_read_bytes
counter_type link_write_bytes
bool push_ifconfig_ipv6_defined
struct fragment_master * fragment
bool push_ifconfig_defined
counter_type dco_read_bytes
struct man_def_auth_context mda_context
counter_type dco_write_bytes
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
struct in6_addr push_ifconfig_ipv6_remote
struct link_socket_actual from
struct frame frame_fragment
int push_ifconfig_ipv6_netbits
struct in6_addr push_ifconfig_ipv6_local
struct link_socket ** link_sockets
in_addr_t push_ifconfig_local_alias
struct link_socket_info ** link_socket_infos
struct link_socket_actual * to_link_addr
in_addr_t push_ifconfig_remote_netmask
struct timeval timeval
Time to next event of timers and similar.
struct event_set * event_set
struct context_buffers * buffers
in_addr_t push_ifconfig_local
Contains all state information for one tunnel.
int mode
Role of this context within the OpenVPN process.
struct signal_info * sig
Internal error signaling object.
struct plugin_list * plugins
List of plug-ins.
struct context_2 c2
Level 2 context.
struct env_set * es
Set of environment variables.
struct options options
Options loaded from command line or configuration file.
struct context_1 c1
Level 1 context.
Security parameter state for processing data channel packets.
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
struct multi_instance * mi
struct buffer outgoing
Buffer containing the remaining parts of the fragmented packet being sent.
Packet geometry parameters.
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
Garbage collection arena used to keep track of dynamically allocated memory.
struct iroute_ipv6 * next
Container for bidirectional cipher and HMAC key material.
Security parameter state of one TLS and data channel key session.
struct auth_deferred_status plugin_auth
struct auth_deferred_status script_auth
enum ks_auth_state authenticated
Container for unidirectional cipher and HMAC key material.
struct openvpn_sockaddr dest
struct link_socket_actual actual
struct link_socket_addr * lsa
struct link_socket_info info
char *(* get_peer_info)(void *arg, const unsigned long cid)
bool(* 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)
void(* delete_event)(void *arg, event_t event)
int(* kill_by_addr)(void *arg, const in_addr_t addr, const int port, const int proto)
bool(* client_pending_auth)(void *arg, const unsigned long cid, const unsigned int kid, const char *extra, unsigned int timeout)
int(* n_clients)(void *arg)
void(* status)(void *arg, const int version, struct status_output *so)
int(* kill_by_cn)(void *arg, const char *common_name)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
void(* show_net)(void *arg, const int msglevel)
struct mbuf_buffer * buffer
struct multi_instance * instance
struct mroute_addr::@2::@6 v6
uint8_t addr[OPENVPN_ETH_ALEN]
unsigned int cache_generation
Main OpenVPN server state structure.
struct schedule * schedule
struct mbuf_set * mbuf
Set of buffers for passing data channel packets between VPN tunnel instances.
struct initial_packet_rate_limit * initial_rate_limiter
struct deferred_signal_schedule_entry deferred_shutdown_signal
struct multi_reap * reaper
struct multi_io * multi_io
I/O state and events tracker.
struct hash * hash
VPN tunnel instances indexed by real address of the remote peer.
unsigned long cid_counter
struct event_timeout stale_routes_check_et
struct ifconfig_pool * ifconfig_pool
struct frequency_limit * new_connection_limiter
struct context top
Storage structure for process-wide configuration.
struct multi_instance * pending
struct hash * vhash
VPN tunnel instances indexed by virtual address of remote hosts.
struct hash * iter
VPN tunnel instances indexed by real address of the remote peer, optimized for iteration.
struct multi_instance ** instances
Array of multi_instances.
struct multi_instance ** mpp_touched
struct multi_instance * earliest_wakeup
struct mroute_helper * route_helper
Server-mode state structure for one single VPN tunnel.
struct buffer_list * cc_config
struct client_connect_defer_state client_connect_defer_state
time_t created
Time at which a VPN tunnel instance was created.
char msg_prefix[MULTI_PREFIX_MAX_LENGTH]
struct mroute_addr real
External network address of the remote peer.
ifconfig_pool_handle vaddr_handle
struct in6_addr reporting_addr_ipv6
struct event_arg ev_arg
this struct will store a pointer to either mi or link_socket, depending on the event type,...
struct context context
The context structure storing state for this VPN tunnel.
unsigned int cache_generation
struct multi_instance * instance
union openvpn_sockaddr::@20 addr
struct compress_options comp
int push_ifconfig_ipv6_netbits
int max_routes_per_client
const char * ncp_ciphers_conf
The original ncp_ciphers specified by the user in the configuration.
in_addr_t push_ifconfig_constraint_network
unsigned int imported_protocol_flags
int stale_routes_ageing_time
in_addr_t ifconfig_pool_netmask
bool push_ifconfig_defined
bool ifconfig_pool_defined
in_addr_t ifconfig_pool_end
bool ifconfig_ipv6_pool_defined
const char * client_disconnect_script
struct connection_entry ce
struct iroute_ipv6 * iroutes_ipv6
in_addr_t push_ifconfig_local_alias
const char * learn_address_script
int stale_routes_check_interval
int ifconfig_ipv6_pool_netbits
in_addr_t push_ifconfig_constraint_netmask
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
in_addr_t push_ifconfig_local
bool push_ifconfig_constraint_defined
bool force_key_material_export
struct in6_addr push_ifconfig_ipv6_remote
const char * client_connect_script
bool push_ifconfig_ipv6_defined
struct in6_addr push_ifconfig_ipv6_local
in_addr_t ifconfig_pool_start
in_addr_t push_ifconfig_remote_netmask
struct in6_addr ifconfig_ipv6_pool_base
const char * client_config_dir
int ifconfig_ipv6_netbits
struct openvpn_plugin_string_list * list[MAX_PLUGINS]
volatile int signal_received
Security parameter state for a single VPN tunnel.
bool remote_usescomp
remote announced comp-lzo in OCC string
char * remote_ciphername
cipher specified in peer's config file
enum multi_status multi_state
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
struct cert_hash_set * locked_cert_hash_set
int dco_peer_id
This is the handle that DCO uses to identify this session with the kernel.
bool data_epoch_supported
whether our underlying data channel supports new data channel features (epoch keys with AEAD tag at t...
Security parameter state of a single session within a VPN tunnel.
struct key_state key[KS_SIZE]
struct in6_addr local_ipv6
static int cleanup(void **state)
int dev_type_enum(const char *dev, const char *dev_type)
#define TUNNEL_TOPOLOGY(tt)
int16_t vlan_decapsulate(const struct context *c, struct buffer *buf)
bool vlan_is_tagged(const struct buffer *buf)