27#ifdef HAVE_SYS_INOTIFY_H
28#include <sys/inotify.h>
29#define INOTIFY_EVENT_BUFFER_SIZE 16384
58#ifdef MULTI_DEBUG_EVENT_LOOP
73#ifdef ENABLE_MANAGEMENT
88 mmap_stats->n_clients = n_clients;
133 msg(
M_WARN,
"WARNING: learn-address plugin call failed");
240#ifdef ENABLE_MANAGEMENT
245 const unsigned long *k = (
const unsigned long *)
key;
252 const unsigned long *k1 = (
const unsigned long *)
key1;
253 const unsigned long *k2 = (
const unsigned long *)
key2;
259#if defined(__GNUC__) || defined(__clang__)
260#pragma GCC diagnostic push
261#pragma GCC diagnostic ignored "-Wconversion"
264#ifdef ENABLE_ASYNC_PUSH
269int_hash_function(
const void *
key, uint32_t iv)
271 return (
unsigned long)
key;
275int_compare_function(
const void *
key1,
const void *
key2)
277 return (
unsigned long)
key1 == (
unsigned long)
key2;
326#ifdef ENABLE_MANAGEMENT
330#ifdef ENABLE_ASYNC_PUSH
335 m->inotify_watchers =
432 "Initializing stale route check timer to run every %i seconds and to removing routes with activity timeout older than %i seconds",
560 msg(
M_WARN,
"WARNING: client-disconnect plugin call failed");
572#ifdef ENABLE_MANAGEMENT
616#ifdef ENABLE_MANAGEMENT
623#ifdef ENABLE_ASYNC_PUSH
624 if (mi->inotify_watch != -1)
626 hash_remove(m->inotify_watchers, (
void *)(
unsigned long)mi->inotify_watch);
627 mi->inotify_watch = -1;
643 mi->did_iroutes =
false;
654#ifdef ENABLE_MANAGEMENT
704#ifdef ENABLE_MANAGEMENT
711#ifdef ENABLE_ASYNC_PUSH
713 m->inotify_watchers = NULL;
766 "MULTI: new incoming connection would exceed maximum number of clients (%d)",
782 msg(
D_MULTI_LOW,
"MULTI: unable to add real address [%s] to iterator hash table",
788#ifdef ENABLE_MANAGEMENT
797#ifdef ENABLE_ASYNC_PUSH
798 mi->inotify_watch = -1;
803 msg(
D_MULTI_ERRORS,
"MULTI: signal occurred during client instance initialization");
852 status_printf(so,
"Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
873 status_printf(so,
"Virtual Address,Common Name,Real Address,Last Ref");
884 char flags[2] = { 0, 0 };
919 "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",
920 sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep,
sep);
962 "HEADER%cROUTING_TABLE%cVirtual Address%cCommon Name%cReal Address%cLast Ref%cLast Ref (time_t)",
963 sep, sep, sep, sep, sep, sep);
974 char flags[2] = { 0, 0 };
985 (
unsigned int)
route->last_reference);
1006#ifdef PACKET_TRUNCATION_CHECK
1008 status_printf(
so,
"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
1035#ifdef ENABLE_ASYNC_PUSH
1036 if (m->inotify_watchers)
1053 const unsigned int flags)
1078 bool learn_succeeded =
false;
1097 learn_succeeded =
true;
1107 he->
value = newroute;
1114 learn_succeeded =
true;
1124 msg(
D_MULTI_LOW,
"MULTI: Learn%s: %s -> %s", learn_succeeded ?
"" :
" FAILED",
1127 if (!learn_succeeded)
1162 else if (cidr_routing)
1169 for (
i = 0;
i <
rh->n_net_len; ++
i)
1236#ifdef ENABLE_MANAGEMENT
1274#ifdef ENABLE_MANAGEMENT
1357 if (mi != new_mi && !mi->
halt)
1360 if (cn && !strcmp(cn, new_cn))
1374 "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.",
1464 "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.");
1469 in_addr_t local = 0, remote = 0;
1470 struct in6_addr remote_ipv6;
1471 const char *cn = NULL;
1486 msg(
M_INFO,
"MULTI_sva: pool returned IPv4=%s, IPv6=%s",
1491 :
"(Not enabled)"));
1510 if (tunnel_topology ==
TOP_P2P)
1527 "MULTI: no --ifconfig-pool netmask parameter is available to push to %s",
1561 msg(
M_INFO,
"MULTI_sva: push_ifconfig_ipv6 %s/%d",
1620 unsigned int *option_types_found)
1646 const struct plugin_return *pr,
unsigned int *option_types_found)
1656 for (
i = 0;
i < config.
n; ++
i)
1685 unsigned int *option_types_found)
1690#ifdef ENABLE_MANAGEMENT
1696 const char *opt =
BSTR(&be->
buf);
1762 msg(
M_INFO,
"Client does not support DATA_V2. Data channel offloading "
1763 "requires DATA_V2. Dropping client.");
1765 "failed (missing DATA_V2)");
1773 msg(
M_WARN,
"Note: peer reports running in P2P mode (no --pull/--client "
1774 "option). It will not negotiate ciphers with this server. "
1775 "Expect this connection to fail.");
1789 msg(
M_INFO,
"PUSH: client does not support TLS Keying Material "
1790 "Exporters but --force-tls-key-material-export is enabled.");
1792 "server. Keying Material Exporters (RFC 5705) "
1793 "support missing. Upgrade to a client that "
1794 "supports this feature (OpenVPN 2.6.0+).");
1816 "PUSH: client wants to negotiate cipher (NCP), but "
1817 "server has already generated data channel keys, "
1818 "re-sending previously negotiated cipher '%s'",
1852 if (strlen(peer_ciphers) > 0)
1855 "PUSH: No common cipher between server and client. "
1856 "Server data-ciphers: '%s'%s, client supported ciphers '%s'",
1862 "PUSH: No common cipher between server and client. "
1863 "Server data-ciphers: '%s'%s, client supports cipher '%s'",
1868 msg(
M_INFO,
"PUSH: No NCP or OCC cipher data received from peer.");
1873 "Using data channel cipher '%s' since "
1874 "--data-ciphers-fallback is set.",
1880 msg(
M_INFO,
"Use --data-ciphers-fallback with the cipher the "
1881 "client is using if you want to allow the client to connect");
1887 "failed (no shared cipher)");
1966 const int c = fgetc(fp);
1991 msg(
M_WARN,
"WARNING: Unknown/unexpected value in deferred "
1992 "client-connect resultfile");
2056 bool deferred,
unsigned int *option_types_found)
2062 ASSERT(option_types_found);
2105 msg(
M_WARN,
"WARNING: client-connect plugin call failed");
2146 bool deferred,
unsigned int *option_types_found)
2152 ASSERT(option_types_found);
2173 msg(
M_WARN,
"A plugin that defers from the "
2174 "OPENVPN_PLUGIN_CLIENT_CONNECT_V2 call must also "
2175 "declare support for "
2176 "OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2");
2182 msg(
M_WARN,
"WARNING: client-connect-v2 plugin call failed");
2195 unsigned int *option_types_found)
2198 ASSERT(option_types_found);
2224 msg(
M_INFO,
"MULTI: deferred --client-connect script returned CC_RET_FAILED");
2305 strerror(-ret), ret);
2318 struct frame *frame_fragment = NULL;
2319#ifdef ENABLE_FRAGMENT
2340 const unsigned int option_types_found)
2357 "MULTI: no dynamic or static remote "
2358 "--ifconfig address is available for %s",
2367 const char *ifconfig_constraint_network =
2369 const char *ifconfig_constraint_netmask =
2374 "MULTI ERROR: primary virtual IP for %s (%s) "
2375 "violates tunnel network/netmask constraint (%s/%s)",
2378 ifconfig_constraint_network, ifconfig_constraint_netmask);
2428 const char *ifconfig_local_ipv6 =
2448 "MULTI: --iroute options rejected for %s -- iroute "
2449 "only works with tun-style tunnels",
2498 bool deferred,
unsigned int *option_types_found)
2506 if (peer_info && strstr(peer_info,
"IV_COMP_STUBv2=1"))
2530 unsigned int *option_types_found)
2539 const char *ccd_file = NULL;
2541 const char *ccd_client =
2545 const char *ccd_default =
2552 ccd_file = ccd_client;
2557 ccd_file = ccd_default;
2581 unsigned int *option_types_found);
2607 "user/password method is enabled. Enable "
2608 "--management-client-auth, --auth-user-pass-verify, or a "
2609 "plugin with user/password verify capability.");
2646 "MULTI: Note, override-username changes username "
2647 "from '%s' to '%s'",
2684 *cur_handler_index = 0;
2685 *option_types_found = 0;
2692 bool cc_succeeded =
true;
2699 from_deferred =
false;
2731 cc_succeeded =
false;
2742 if (mi->context.options.disable)
2745 "'disable' directive");
2746 cc_succeeded =
false;
2749 (*cur_handler_index)++;
2756 cc_succeeded =
false;
2764 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to incompatible DCO options");
2765 cc_succeeded =
false;
2770 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to invalid compression options");
2771 cc_succeeded =
false;
2795#ifdef ENABLE_MANAGEMENT
2804#ifdef ENABLE_ASYNC_PUSH
2812multi_process_file_closed(
struct multi_context *m,
const unsigned int mpp_flags)
2814 char buffer[INOTIFY_EVENT_BUFFER_SIZE];
2815 size_t buffer_i = 0;
2816 int r =
read(m->
top.
c2.inotify_fd,
buffer, INOTIFY_EVENT_BUFFER_SIZE);
2818 while (buffer_i < r)
2821 struct inotify_event *pevent = (
struct inotify_event *)&
buffer[buffer_i];
2822 size_t event_size =
sizeof(
struct inotify_event) + pevent->len;
2823 buffer_i += event_size;
2825 msg(
D_MULTI_DEBUG,
"MULTI: modified fd %d, mask %d", pevent->wd, pevent->mask);
2828 hash_lookup(m->inotify_watchers, (
void *)(
unsigned long)pevent->wd);
2830 if (pevent->mask & IN_CLOSE_WRITE)
2842 else if (pevent->mask & IN_IGNORED)
2847 hash_remove(m->inotify_watchers, (
void *)(
unsigned long)pevent->wd);
2848 mi->inotify_watch = -1;
2875 msg(
D_MULTI_DROPPED,
"MULTI: packet dropped due to output saturation (multi_add_mbuf)");
2911#ifdef MULTI_DEBUG_EVENT_LOOP
2912 printf(
"BCAST len=%d\n",
BLEN(
buf));
2920 if (mi != sender_instance && !mi->
halt)
2947static inline unsigned int
2950 if (delta->tv_sec < 1)
2953 return delta->tv_usec >> 3;
2958 if (delta->tv_sec < 600)
2960 return delta->tv_sec << 17;
2981#if defined(ENABLE_ASYNC_PUSH)
2987 long watch_descriptor = inotify_add_watch(inotify_fd, file, IN_CLOSE_WRITE | IN_ONESHOT);
2988 if (watch_descriptor >= 0)
2990 if (mi->inotify_watch != -1)
2992 hash_remove(m->inotify_watchers, (
void *)(
unsigned long)mi->inotify_watch);
2994 hash_add(m->inotify_watchers, (
const uintptr_t *)watch_descriptor, mi,
true);
2995 mi->inotify_watch = watch_descriptor;
3020#if defined(ENABLE_ASYNC_PUSH)
3021 bool was_unauthenticated =
true;
3034#if defined(ENABLE_ASYNC_PUSH)
3061#if defined(ENABLE_ASYNC_PUSH)
3065 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3087#ifdef MULTI_DEBUG_EVENT_LOOP
3088 printf(
"POST %s[%d] to=%d lo=%d/%d w=%" PRIi64
"/%ld\n",
id(mi), (
int)(mi == m->
pending),
3144 msg(
D_MULTI_LOW,
"Disallow float to an address taken by another client %s",
3159 "disallowing peer %" PRIu32
" (%s) from floating to "
3160 "its own address (%s)",
3167 "closing instance %s due to float collision with %s "
3168 "using the same certificate",
3198#ifdef ENABLE_MANAGEMENT
3220#if (defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))) \
3221 || defined(ENABLE_MANAGEMENT)
3230#if defined(ENABLE_DCO)
3234 const char *reason =
"ovpn-dco: unknown reason";
3235 switch (
dco->dco_del_peer_reason)
3238 reason =
"ovpn-dco: ping expired";
3242 reason =
"ovpn-dco: transport error";
3246 reason =
"ovpn-dco: transport disconnected";
3283 int peer_id = dco->dco_message_peer_id;
3293 if ((peer_id < m->max_clients) && (m->
instances[peer_id]))
3299 process_incoming_del_peer(m, mi, dco);
3306 (
struct sockaddr *)&dco->dco_float_peer_ss);
3308 CLEAR(dco->dco_float_peer_ss);
3332 "Received DCO message for unknown peer-id: %d, "
3333 "type %d, del_peer_reason %d",
3334 peer_id, dco->dco_message_type, dco->dco_del_peer_reason);
3337 dco->dco_message_type = 0;
3338 dco->dco_message_peer_id = -1;
3339 dco->dco_del_peer_reason = -1;
3340 dco->dco_read_bytes = 0;
3341 dco->dco_write_bytes = 0;
3352 const unsigned int mpp_flags,
struct link_socket *sock)
3361 bool floated =
false;
3370#ifdef MULTI_DEBUG_EVENT_LOOP
3402 const uint8_t *orig_buf;
3437 && IN6_IS_ADDR_LINKLOCAL(&src.
v6.
addr))
3444 "MULTI: bad source address from client [%s], packet dropped",
3524 "MULTI: bad source address from client [%s], packet dropped",
3557 unsigned int mroute_flags;
3562#ifdef MULTI_DEBUG_EVENT_LOOP
3563 printf(
"TUN -> TCP/UDP [%d]\n",
BLEN(&
m->top.c2.buf));
3571 if (dev_type ==
DEV_TYPE_TAP &&
m->top.options.vlan_tagging)
3619 "MULTI: packet dropped due to output saturation (multi_process_incoming_tun)");
3683#ifdef MULTI_DEBUG_EVENT_LOOP
3737 "MULTI ROUTE: route quota (%d) exceeded for %s (see --max-routes-per-client option)",
3749 const int level = GREMLIN_PACKET_FLOOD_LEVEL(m->
top.
options.gremlin);
3754 struct packet_flood_parms parm = get_packet_flood_parms(level);
3760 msg(
D_GREMLIN,
"GREMLIN_FLOOD_CLIENTS: flooding clients with %d packets of size %d",
3761 parm.n_packets, parm.packet_size);
3763 for (
i = 0;
i < parm.packet_size; ++
i)
3768 for (
i = 0;
i < parm.n_packets; ++
i)
3781 struct timeval null;
3808 gremlin_flood_clients(m);
3817#ifdef ENABLE_MANAGEMENT
3842 return (sig == SIGUSR1 || sig == SIGTERM || sig == SIGHUP || sig == SIGINT);
3908#ifdef ENABLE_MANAGEMENT
3947 if (cn && !strcmp(cn, del_cn))
3990#if defined(__GNUC__) || defined(__clang__)
3991#pragma GCC diagnostic pop
4010 if (mi && !mi->
halt)
4037 const char *extra,
unsigned int timeout)
4072 const bool auth,
const char *reason,
const char *client_reason,
4077 bool cc_config_owned =
true;
4090 cc_config_owned =
false;
4095 msg(
D_MULTI_LOW,
"MULTI: connection rejected: %s, CLI:%s", reason,
4128#ifdef ENABLE_MANAGEMENT
4246#ifdef ENABLE_ASYNC_PUSH
4247 multi.
top.
c2.inotify_fd = inotify_init();
4248 if (multi.
top.
c2.inotify_fd < 0)
4256#ifdef ENABLE_ASYNC_PUSH
4257 close(
top->
c2.inotify_fd);
4282 struct in_addr addr;
4283 struct in6_addr new_ipv6;
4288 in_addr_t new_ip = ntohl(addr.s_addr);
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.
void generate_auth_token(const struct user_pass *up, struct tls_multi *multi)
Generate an auth token based on username and timestamp.
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, msglvl_t msglevel)
Checks if the compression settings are valid.
#define COMP_ALG_STUB
support compression command byte and framing without actual compression
#define COMP_F_MIGRATE
push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ
#define ENABLE_MANAGEMENT
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_get_peer_stats_multi(dco_context_t *dco, const bool raise_sigusr1_on_err)
static int dco_do_read(dco_context_t *dco)
static void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, struct mroute_addr *addr)
static bool dco_check_option(msglvl_t 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, msglvl_t msglevel)
void pre_select(struct context *c)
void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf, struct link_socket *sock)
void extract_dco_float_peer_addr(const sa_family_t socket_family, struct openvpn_sockaddr *out_osaddr, const struct sockaddr *float_sa)
Transfers float_sa data extracted from an incoming DCO PEER_FLOAT_NTF to out_osaddr for later process...
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)
bool do_deferred_options(struct context *c, const unsigned int found, const bool is_update)
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)
struct context_buffers * init_context_buffers(const struct frame *frame)
void management_show_net_callback(void *arg, const msglvl_t msglevel)
#define CC_HARD_USR1_TO_HUP
static unsigned int constrain_uint(unsigned int x, unsigned int min, unsigned int max)
static int min_int(int x, int y)
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 uint32_t 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_free(struct hash *hash)
bool hash_add(struct hash *hash, const void *key, void *value, bool replace)
void hash_iterator_init_range(struct hash *hash, struct hash_iterator *hi, uint32_t start_bucket, uint32_t end_bucket)
static bool hash_remove(struct hash *hash, const void *key)
static void * hash_lookup(struct hash *hash, const void *key)
static uint32_t hash_n_elements(const struct hash *hash)
static uint32_t hash_n_buckets(const struct hash *hash)
static uint32_t hash_value(const struct hash *hash, const void *key)
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_check_bytecount_server(struct multi_context *multi)
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)
const char * mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc)
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 void multi_process_float(struct multi_context *m, struct multi_instance *mi, struct link_socket *sock)
Handles peer floating.
static void multi_reap_range(const struct multi_context *m, uint32_t start_bucket, uint32_t end_bucket)
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_top_free(struct multi_context *m)
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 bool override_locked_username(struct multi_instance *mi)
Overrides the locked username with the username of –override-username.
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)
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)
static int management_callback_kill_by_cn(void *arg, const char *del_cn)
static bool stale_route_check_trigger(struct multi_context *m)
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 void multi_init(struct context *t)
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 void multi_uninit(struct multi_context *m)
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)
void update_vhash(struct multi_context *m, struct multi_instance *mi, const char *old_ip, const char *old_ipv6)
Update the vhash with new IP/IPv6 addresses in the multi_context when a push-update message containin...
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_top_init(struct context *top)
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 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 void multi_print_status(struct multi_context *m, struct status_output *so, const int version)
void route_quota_exceeded(const struct multi_instance *mi)
void ungenerate_prefix(struct multi_instance *mi)
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 struct multi_reap * multi_reap_new(uint32_t buckets_per_pass)
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 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 uint32_t reap_buckets_per_pass(uint32_t n_buckets)
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...
static const multi_client_connect_handler client_connect_handlers[]
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)
struct multi_io * multi_io_init(const int maxclients)
void multi_io_process_io(struct multi_context *m)
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)
#define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER
#define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2
#define OPENVPN_PLUGIN_CLIENT_CONNECT_V2
#define OPENVPN_PLUGIN_LEARN_ADDRESS
#define OPENVPN_PLUGIN_CLIENT_CONNECT
#define OPENVPN_PLUGIN_FUNC_DEFERRED
#define OPENVPN_PLUGIN_FUNC_SUCCESS
#define OPENVPN_PLUGIN_CLIENT_DISCONNECT
static bool check_debug_level(msglvl_t level)
static bool is_cas_pending(enum multi_status cas)
void options_string_import(struct options *options, const char *config, const msglvl_t msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void options_server_import(struct options *o, const char *filename, msglvl_t msglevel, 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_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 push_option(struct options *o, const char *opt, msglvl_t msglevel)
void send_restart(struct context *c, const char *kill_msg)
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)
bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options)
bool management_callback_send_push_update_broadcast(void *arg, const char *options)
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 print_signal(const struct signal_info *si, const char *title, msglvl_t msglevel)
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 setenv_trusted(struct env_set *es, const struct link_socket_info *info)
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_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)
#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.
#define SSLF_USERNAME_AS_COMMON_NAME
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 ssl_verify_username_length(struct tls_session *session, const char *username)
Checks if the username length is valid to use.
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 set_common_name(struct tls_session *session, const char *common_name)
Sets the common name 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 multi_context * multi
Pointer to the main P2MP context.
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)
bool(* push_update_broadcast)(void *arg, const char *options)
bool(* push_update_by_cid)(void *arg, unsigned long cid, const char *options)
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)
void(* show_net)(void *arg, const msglvl_t msglevel)
int(* kill_by_cn)(void *arg, const char *common_name)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
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.
uint32_t buckets_per_pass
unsigned int cache_generation
struct multi_instance * instance
union openvpn_sockaddr::@27 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
const char * ifconfig_ipv6_local
bool push_ifconfig_defined
bool ifconfig_pool_defined
in_addr_t ifconfig_pool_end
bool ifconfig_ipv6_pool_defined
const char * client_disconnect_script
const char * ifconfig_local
struct connection_entry ce
struct iroute_ipv6 * iroutes_ipv6
in_addr_t push_ifconfig_local_alias
uint32_t virtual_hash_size
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
const char * override_username
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.
char * auth_token_initial
The first auth-token we sent to a client.
bool remote_usescomp
remote announced comp-lzo in OCC string
char * peer_info
A multi-line string of general-purpose info received from peer over control channel.
char * remote_ciphername
cipher specified in peer's config file
char * locked_username
The locked username is the username we assume the client is using.
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
char * locked_cn
Our locked common name, username, and cert hashes (cannot change during the life of this tls_multi ob...
char * locked_original_username
The username that client initially used before being overridden by –override-user.
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
char username[USER_PASS_LEN]
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)