Go to the documentation of this file.
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
84 #ifdef ENABLE_MEMSTATS
87 mmap_stats->n_clients = n_clients;
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
276 int_hash_function(
const void *
key, uint32_t iv)
278 return (
unsigned long)
key;
282 int_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);
456 msg(
M_INFO,
"Initializing stale route check timer to run every %i seconds and to removing routes with activity timeout older than %i seconds",
581 msg(
M_WARN,
"WARNING: client-disconnect plugin call failed");
593 #ifdef ENABLE_MANAGEMENT
638 #ifdef ENABLE_MANAGEMENT
645 #ifdef ENABLE_ASYNC_PUSH
646 if (mi->inotify_watch != -1)
648 hash_remove(m->inotify_watchers, (
void *) (
unsigned long)mi->inotify_watch);
649 mi->inotify_watch = -1;
665 mi->did_iroutes =
false;
676 #ifdef ENABLE_MANAGEMENT
726 #ifdef ENABLE_MANAGEMENT
733 #ifdef ENABLE_ASYNC_PUSH
735 m->inotify_watchers = NULL;
801 msg(
D_MULTI_LOW,
"MULTI: unable to add real address [%s] to iterator hash table",
807 #ifdef ENABLE_MANAGEMENT
816 #ifdef ENABLE_ASYNC_PUSH
817 mi->inotify_watch = -1;
822 msg(
D_MULTI_ERRORS,
"MULTI: signal occurred during client instance initialization");
865 status_printf(so,
"Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
886 status_printf(so,
"Virtual Address,Common Name,Real Address,Last Ref");
897 char flags[2] = {0, 0};
923 else if (version == 2 || version == 3)
925 const char sep = (version == 3) ?
'\t' :
',';
932 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",
933 sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep);
956 sep, (
unsigned int)mi->
created,
970 status_printf(so,
"HEADER%cROUTING_TABLE%cVirtual Address%cCommon Name%cReal Address%cLast Ref%cLast Ref (time_t)",
971 sep, sep, sep, sep, sep, sep);
982 char flags[2] = {0, 0};
993 sep, (
unsigned int)
route->last_reference);
1001 status_printf(so,
"GLOBAL_STATS%cMax bcast/mcast queue length%c%d",
1010 status_printf(so,
"ERROR: bad status format version number");
1013 #ifdef PACKET_TRUNCATION_CHECK
1015 status_printf(so,
"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
1026 m->
top.
c2.n_trunc_tun_read,
1041 #ifdef ENABLE_ASYNC_PUSH
1042 if (m->inotify_watchers)
1061 const unsigned int flags)
1086 bool learn_succeeded =
false;
1105 learn_succeeded =
true;
1115 he->
value = newroute;
1122 learn_succeeded =
true;
1133 learn_succeeded ?
"" :
" FAILED",
1137 if (!learn_succeeded)
1173 else if (cidr_routing)
1240 remote_si.
addr.
in4.sin_family = AF_INET;
1241 remote_si.
addr.
in4.sin_addr.s_addr = htonl(a);
1251 #ifdef ENABLE_MANAGEMENT
1291 #ifdef ENABLE_MANAGEMENT
1378 if (mi != new_mi && !mi->
halt)
1381 if (cn && !strcmp(cn, new_cn))
1394 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);
1480 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." );
1485 in_addr_t local = 0, remote = 0;
1486 struct in6_addr remote_ipv6;
1487 const char *cn = NULL;
1501 msg(
M_INFO,
"MULTI_sva: pool returned IPv4=%s, IPv6=%s",
1507 :
"(Not enabled)") );
1523 if (tunnel_topology ==
TOP_P2P)
1540 "MULTI: no --ifconfig-pool netmask parameter is available to push to %s",
1578 msg(
M_INFO,
"MULTI_sva: push_ifconfig_ipv6 %s/%d",
1602 "ifconfig_pool_remote_ip",
1609 "ifconfig_pool_netmask",
1616 "ifconfig_pool_local_ip",
1629 "ifconfig_pool_remote",
1633 "ifconfig_pool_local",
1637 "ifconfig_pool_ip6_netbits",
1648 const char *dc_file,
1649 unsigned int *option_types_found)
1672 #ifdef ENABLE_PLUGIN
1681 unsigned int *option_types_found)
1691 for (i = 0; i < config.
n; ++i)
1725 unsigned int *option_types_found)
1730 #ifdef ENABLE_MANAGEMENT
1736 const char *opt =
BSTR(&be->
buf);
1807 msg(
M_INFO,
"Client does not support DATA_V2. Data channel offloaing "
1808 "requires DATA_V2. Dropping client.");
1810 "failed (missing DATA_V2)");
1818 msg(
M_WARN,
"Note: peer reports running in P2P mode (no --pull/--client"
1819 "option). It will not negotiate ciphers with this server. "
1820 "Expect this connection to fail.");
1828 #ifdef HAVE_EXPORT_KEYING_MATERIAL
1835 msg(
M_INFO,
"PUSH: client does not support TLS Keying Material "
1836 "Exporters but --force-tls-key-material-export is enabled.");
1838 "server. Keying Material Exporters (RFC 5705) "
1839 "support missing. Upgrade to a client that "
1840 "supports this feature (OpenVPN 2.6.0+).");
1862 msg(
M_INFO,
"PUSH: client wants to negotiate cipher (NCP), but "
1863 "server has already generated data channel keys, "
1864 "re-sending previously negotiated cipher '%s'",
1893 if (strlen(peer_ciphers) > 0)
1895 msg(
M_INFO,
"PUSH: No common cipher between server and client. "
1896 "Server data-ciphers: '%s', client supported ciphers '%s'",
1901 msg(
M_INFO,
"PUSH: No common cipher between server and client. "
1902 "Server data-ciphers: '%s', client supports cipher '%s'",
1907 msg(
M_INFO,
"PUSH: No NCP or OCC cipher data received from peer.");
1911 msg(
M_INFO,
"Using data channel cipher '%s' since "
1912 "--data-ciphers-fallback is set.", o->
ciphername);
1917 msg(
M_INFO,
"Use --data-ciphers-fallback with the cipher the "
1918 "client is using if you want to allow the client to connect");
1924 "failed (no shared cipher)");
2005 const int c = fgetc(fp);
2030 msg(
M_WARN,
"WARNING: Unknown/unexpected value in deferred"
2031 "client-connect resultfile");
2099 unsigned int *option_types_found)
2102 #ifdef ENABLE_PLUGIN
2105 ASSERT(option_types_found);
2150 msg(
M_WARN,
"WARNING: client-connect plugin call failed");
2175 option_types_found);
2194 unsigned int *option_types_found)
2197 #ifdef ENABLE_PLUGIN
2200 ASSERT(option_types_found);
2224 msg(
M_WARN,
"A plugin that defers from the "
2225 "OPENVPN_PLUGIN_CLIENT_CONNECT_V2 call must also "
2226 "declare support for "
2227 "OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2");
2233 msg(
M_WARN,
"WARNING: client-connect-v2 plugin call failed");
2247 unsigned int *option_types_found)
2250 ASSERT(option_types_found);
2277 msg(
M_INFO,
"MULTI: deferred --client-connect script returned CC_RET_FAILED");
2329 option_types_found);
2362 msg(
D_DCO,
"Cannot add peer to DCO for %s: %s (%d)",
2376 msg(
D_DCO,
"Cannot set DCO peer parameters for %s (id=%u): %s",
2391 struct frame *frame_fragment = NULL;
2392 #ifdef ENABLE_FRAGMENT
2414 const unsigned int option_types_found)
2431 "--ifconfig address is available for %s",
2440 const char *ifconfig_constraint_network =
2442 const char *ifconfig_constraint_netmask =
2447 "violates tunnel network/netmask constraint (%s/%s)",
2450 ifconfig_constraint_network, ifconfig_constraint_netmask);
2475 const char *ifconfig_local_ipv6 =
2479 ifconfig_local_ipv6);
2496 "only works with tun-style tunnels",
2572 unsigned int *option_types_found)
2580 if (peer_info && strstr(peer_info,
"IV_COMP_STUBv2=1"))
2606 unsigned int *option_types_found)
2615 const char *ccd_file = NULL;
2617 const char *ccd_client =
2622 const char *ccd_default =
2630 ccd_file = ccd_client;
2635 ccd_file = ccd_default;
2663 bool from_deferred,
unsigned int *option_types_found);
2702 unsigned int *option_types_found =
2708 *cur_handler_index = 0;
2709 *option_types_found = 0;
2716 bool cc_succeeded =
true;
2723 option_types_found);
2725 from_deferred =
false;
2757 cc_succeeded =
false;
2768 if (mi->context.options.disable)
2771 "'disable' directive");
2772 cc_succeeded =
false;
2775 (*cur_handler_index)++;
2782 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to incompatible DCO options");
2783 cc_succeeded =
false;
2788 msg(
D_MULTI_ERRORS,
"MULTI: client has been rejected due to invalid compression options");
2789 cc_succeeded =
false;
2813 #ifdef ENABLE_MANAGEMENT
2822 #ifdef ENABLE_ASYNC_PUSH
2830 multi_process_file_closed(
struct multi_context *m,
const unsigned int mpp_flags)
2832 char buffer[INOTIFY_EVENT_BUFFER_SIZE];
2833 size_t buffer_i = 0;
2834 int r =
read(m->
top.
c2.inotify_fd,
buffer, INOTIFY_EVENT_BUFFER_SIZE);
2836 while (buffer_i < r)
2839 struct inotify_event *pevent = (
struct inotify_event *) &
buffer[buffer_i];
2840 size_t event_size =
sizeof(
struct inotify_event) + pevent->len;
2841 buffer_i += event_size;
2843 msg(
D_MULTI_DEBUG,
"MULTI: modified fd %d, mask %d", pevent->wd, pevent->mask);
2847 if (pevent->mask & IN_CLOSE_WRITE)
2859 else if (pevent->mask & IN_IGNORED)
2864 hash_remove(m->inotify_watchers, (
void *) (
unsigned long) pevent->wd);
2865 mi->inotify_watch = -1;
2894 msg(
D_MULTI_DROPPED,
"MULTI: packet dropped due to output saturation (multi_add_mbuf)");
2903 const struct buffer *buf,
2935 #ifdef MULTI_DEBUG_EVENT_LOOP
2936 printf(
"BCAST len=%d\n",
BLEN(
buf));
2944 if (mi != sender_instance && !mi->
halt)
2971 static inline unsigned int
2974 if (delta->tv_sec < 1)
2977 return delta->tv_usec >> 3;
2982 if (delta->tv_sec < 600)
2984 return delta->tv_sec << 17;
3007 #if defined(ENABLE_ASYNC_PUSH)
3010 int inotify_fd,
const char *file)
3013 long watch_descriptor = inotify_add_watch(inotify_fd, file,
3014 IN_CLOSE_WRITE | IN_ONESHOT);
3015 if (watch_descriptor >= 0)
3017 if (mi->inotify_watch != -1)
3020 (
void *) (
unsigned long)mi->inotify_watch);
3022 hash_add(m->inotify_watchers, (
const uintptr_t *)watch_descriptor,
3024 mi->inotify_watch = watch_descriptor;
3047 #if defined(ENABLE_ASYNC_PUSH)
3048 bool was_unauthenticated =
true;
3061 #if defined(ENABLE_ASYNC_PUSH)
3070 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3076 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3090 #if defined(ENABLE_ASYNC_PUSH)
3094 add_inotify_file_watch(m, mi, m->
top.
c2.inotify_fd,
3117 #ifdef MULTI_DEBUG_EVENT_LOOP
3118 printf(
"POST %s[%d] to=%d lo=%d/%d w=%" PRIi64
"/%ld\n",
3164 msg(
D_MULTI_LOW,
"Disallow float to an address taken by another client %s",
3202 #ifdef ENABLE_MANAGEMENT
3224 #if (defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))) || defined(ENABLE_MANAGEMENT)
3233 #if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))
3238 const char *reason =
"ovpn-dco: unknown reason";
3239 switch (dco->dco_del_peer_reason)
3242 reason =
"ovpn-dco: ping expired";
3246 reason =
"ovpn-dco: transport error";
3250 reason =
"ovpn-dco: transport disconnected";
3287 int peer_id = dco->dco_message_peer_id;
3297 if ((peer_id < m->max_clients) && (m->
instances[peer_id]))
3302 process_incoming_del_peer(m, mi, dco);
3311 int msglevel =
D_DCO;
3324 msg(msglevel,
"Received DCO message for unknown peer-id: %d, "
3325 "type %d, del_peer_reason %d", peer_id, dco->dco_message_type,
3326 dco->dco_del_peer_reason);
3329 dco->dco_message_type = 0;
3330 dco->dco_message_peer_id = -1;
3331 dco->dco_del_peer_reason = -1;
3332 dco->dco_read_bytes = 0;
3333 dco->dco_write_bytes = 0;
3349 unsigned int mroute_flags;
3352 bool floated =
false;
3361 #ifdef MULTI_DEBUG_EVENT_LOOP
3393 const uint8_t *orig_buf;
3431 && IN6_IS_ADDR_LINKLOCAL(&src.
v6.addr) )
3553 unsigned int mroute_flags;
3559 #ifdef MULTI_DEBUG_EVENT_LOOP
3618 msg(
D_MULTI_DROPPED,
"MULTI: packet dropped due to output saturation (multi_process_incoming_tun)");
3680 #ifdef MULTI_DEBUG_EVENT_LOOP
3732 msg(
D_ROUTE_QUOTA,
"MULTI ROUTE: route quota (%d) exceeded for %s (see --max-routes-per-client option)",
3745 const int level = GREMLIN_PACKET_FLOOD_LEVEL(m->
top.
options.gremlin);
3750 struct packet_flood_parms parm = get_packet_flood_parms(level);
3756 msg(
D_GREMLIN,
"GREMLIN_FLOOD_CLIENTS: flooding clients with %d packets of size %d",
3760 for (i = 0; i < parm.packet_size; ++i)
3765 for (i = 0; i < parm.n_packets; ++i)
3778 struct timeval null;
3805 gremlin_flood_clients(m);
3832 return (sig == SIGUSR1 || sig == SIGTERM || sig == SIGHUP || sig == SIGINT);
3899 #ifdef ENABLE_MANAGEMENT
3938 if (cn && !strcmp(cn, del_cn))
3960 saddr.
addr.
in4.sin_family = AF_INET;
3996 if (mi && !mi->
halt)
4023 const unsigned long cid,
4024 const unsigned int mda_key_id,
4026 unsigned int timeout)
4062 const unsigned long cid,
4063 const unsigned int mda_key_id,
4066 const char *client_reason,
4071 bool cc_config_owned =
true;
4084 cc_config_owned =
false;
4089 msg(
D_MULTI_LOW,
"MULTI: connection rejected: %s, CLI:%s", reason,
np(client_reason));
4121 #ifdef ENABLE_MANAGEMENT
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
struct mroute_helper * mroute_helper_init(int ageable_ttl_secs)
struct openvpn_plugin_string_list * list[MAX_PLUGINS]
void setenv_trusted(struct env_set *es, const struct link_socket_info *info)
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)
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)
static struct multi_instance * multi_learn_in6_addr(struct multi_context *m, struct multi_instance *mi, struct in6_addr a6, int netbits, bool primary)
bool mbuf_extract_item(struct mbuf_set *ms, struct mbuf_item *item)
#define OPENVPN_PLUGIN_CLIENT_CONNECT_V2
@ OVPN_CMD_DEL_PEER
@OVPN_CMD_DEL_PEER: Remove peer from internal table
static bool dco_check_option(int msglevel, const struct options *o)
volatile int signal_received
Server-mode state structure for one single VPN tunnel.
bool status_trigger(struct status_output *so)
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.
#define OPENVPN_PLUGIN_LEARN_ADDRESS
@ CAS_PENDING_DEFERRED
Waiting on an async option import handler.
union openvpn_sockaddr::@14 addr
bool multi_process_incoming_dco(struct multi_context *m)
Process an incoming DCO message (from kernel space).
static int hash_n_elements(const struct hash *hash)
static struct multi_instance * lookup_by_cid(struct multi_context *m, const unsigned long cid)
struct mroute_helper * route_helper
const char * client_connect_script
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))
static bool route_quota_test(const struct multi_instance *mi)
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
void print_signal(const struct signal_info *si, const char *title, int msglevel)
#define MPP_CLOSE_ON_SIGNAL
static struct hash_bucket * hash_bucket(struct hash *hash, uint32_t hv)
struct event_timeout stale_routes_check_et
static struct gc_arena gc_new(void)
#define IV_PROTO_DATA_V2
Support P_DATA_V2.
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.
int explicit_exit_notification
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
struct multi_reap * reaper
static void setenv_stats(struct multi_context *m, struct context *c)
#define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER
static bool stale_route_check_trigger(struct multi_context *m)
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)
int len
Length in bytes of the actual content within the allocated memory.
static void buf_reset(struct buffer *buf)
#define MULTI_ROUTE_AGEABLE
static void multi_del_iroutes(struct multi_context *m, struct multi_instance *mi)
void tunnel_server_udp(struct context *top)
Main event loop for OpenVPN in UDP server mode.
struct tuntap * tuntap
Tun/tap virtual network interface.
static void multi_client_connect_post(struct multi_context *m, struct multi_instance *mi, const char *dc_file, unsigned int *option_types_found)
char *(* get_peer_info)(void *arg, const unsigned long cid)
#define CLIENT_CONNECT_OPT_MASK
#define KS_PRIMARY
Primary key state index.
counter_type link_write_bytes
const char * translate_cipher_name_to_openvpn(const char *cipher_name)
Translate a crypto library cipher name to an OpenVPN cipher name.
#define buf_init(buf, offset)
Contains all state information for one tunnel.
static void generate_prefix(struct multi_instance *mi)
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
static bool ifconfig_push_constraint_satisfied(const struct context *c)
static const char *const key1
struct link_socket_addr * lsa
struct mbuf_set * mbuf
Set of buffers for passing data channel packets between VPN tunnel instances.
long int get_random(void)
struct mroute_addr real
External network address of the remote peer.
struct in6_addr push_ifconfig_ipv6_local
static void set_prefix(struct multi_instance *mi)
struct plugin_list * plugins
List of plug-ins.
static void plugin_return_init(struct plugin_return *pr)
struct multi_instance * multi_get_queue(struct mbuf_set *ms)
char * deferred_ret_file
The temporary file name that contains the return status of the client-connect script if it exits with...
bool argv_printf_cat(struct argv *argres, const char *format,...)
printf() inspired argv concatenation.
static void register_activity(struct context *c, const int size)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
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.
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)
void multi_tcp_dereference_instance(struct multi_tcp *mtcp, struct multi_instance *mi)
void argv_free(struct argv *a)
Frees all memory allocations allocated by the struct argv related functions.
bool push_ifconfig_defined
void remove_iroutes_from_push_route_list(struct options *o)
void multi_uninit(struct multi_context *m)
#define IV_PROTO_TLS_KEY_EXPORT
Supports key derivation via TLS key material exporter [RFC5705].
in_addr_t push_ifconfig_local
bool hash_add(struct hash *hash, const void *key, void *value, bool replace)
static unsigned int compute_wakeup_sigma(const struct timeval *delta)
static void multi_client_connect_setenv(struct multi_context *m, struct multi_instance *mi)
@ CAS_PENDING
Options import (Connect script/plugin, ccd,...)
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.
void pre_select(struct context *c)
int(* kill_by_cn)(void *arg, const char *common_name)
@ KS_AUTH_FALSE
Key state is not authenticated
struct in6_addr push_ifconfig_ipv6_local
static bool management_client_pending_auth(void *arg, const unsigned long cid, const unsigned int mda_key_id, const char *extra, unsigned int timeout)
static bool hash_remove(struct hash *hash, const void *key)
static bool learn_address_script(const struct multi_context *m, const struct multi_instance *mi, const char *op, const struct mroute_addr *addr)
void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf)
#define ENABLE_MANAGEMENT
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)
struct connection_entry ce
#define PERF_MULTI_CLOSE_INSTANCE
static void set_cc_config(struct multi_instance *mi, struct buffer_list *cc_config)
static void * hash_lookup(struct hash *hash, const void *key)
#define SA_SET_IF_NONZERO
struct context_buffers * buffers
void multi_close_instance_on_signal(struct multi_context *m, struct multi_instance *mi)
bool ifconfig_ipv6_pool_defined
static void multi_unicast(struct multi_context *m, const struct buffer *buf, struct multi_instance *mi)
static void multi_set_virtual_addr_env(struct multi_instance *mi)
static void multi_client_disconnect_script(struct multi_context *m, struct multi_instance *mi)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
struct context_buffers * init_context_buffers(const struct frame *frame)
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...
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
char * config_file
The temporary file name that contains the config directives returned by the client-connect script.
void multi_ifconfig_pool_persist(struct multi_context *m, bool force)
static int reap_buckets_per_pass(int n_buckets)
struct schedule * schedule
uint32_t mroute_addr_hash_function(const void *key, uint32_t iv)
struct link_socket_info * link_socket_info
This variable is used instead link_socket->info for P2MP UDP childs.
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...
#define PERF_MULTI_CREATE_INSTANCE
Detached client connection state.
int dco_do_read(dco_context_t *dco)
Packet geometry parameters.
static void schedule_add_entry(struct schedule *s, struct schedule_entry *e, const struct timeval *tv, unsigned int sigma)
Security parameter state for a single VPN tunnel.
struct link_socket_actual * to_link_addr
@ OVPN_DEL_PEER_REASON_TRANSPORT_ERROR
void setenv_int(struct env_set *es, const char *name, int value)
@ CAS_FAILED
Option import failed or explicitly denied the client.
uint8_t net_len[MR_HELPER_NET_LEN]
void route_quota_exceeded(const struct multi_instance *mi)
void management_show_net_callback(void *arg, const int msglevel)
enum ks_auth_state authenticated
void multi_process_per_second_timers_dowork(struct multi_context *m)
void setenv_counter(struct env_set *es, const char *name, counter_type value)
static void multi_bcast(struct multi_context *m, const struct buffer *buf, const struct multi_instance *sender_instance, const struct mroute_addr *sender_addr, uint16_t vid)
Security parameter state of one TLS and data channel key session.
enum client_connect_return multi_client_connect_mda(struct multi_context *m, struct multi_instance *mi, bool deferred, unsigned int *option_types_found)
bool push_request_received
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 void buf_reset_len(struct buffer *buf)
Container for unidirectional cipher and HMAC key material.
counter_type link_read_bytes
@ CAS_WAITING_AUTH
Initial TLS connection established but deferred auth is not yet finished.
struct multi_instance * instance
static void multi_signal_instance(struct multi_context *m, struct multi_instance *mi, const int sig)
static const char * np(const char *str)
struct frequency_limit * new_connection_limiter
static int plugin_call(const struct plugin_list *pl, const int type, const struct argv *av, struct plugin_return *pr, struct env_set *es)
void hash_iterator_free(struct hash_iterator *hi)
#define MULTI_CACHE_ROUTE_TTL
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.
#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 ...
unsigned long cid_counter
enum multi_status multi_state
struct deferred_signal_schedule_entry deferred_shutdown_signal
static void clear_prefix(void)
static void multi_instance_dec_refcount(struct multi_instance *mi)
struct context_2 c2
Level 2 context.
void mroute_helper_free(struct mroute_helper *mh)
struct in6_addr push_ifconfig_ipv6_remote
void push_option(struct options *o, const char *opt, int msglevel)
void mroute_helper_del_iroute46(struct mroute_helper *mh, int netbits)
#define TM_ACTIVE
Active tls_session.
char * string_alloc(const char *str, struct gc_arena *gc)
void tls_update_remote_addr(struct tls_multi *multi, const struct link_socket_actual *addr)
Updates remote address in TLS sessions.
struct multi_instance ** instances
Array of multi_instances.
bool remote_usescomp
remote announced comp-lzo in OCC string
void tls_session_soft_reset(struct tls_multi *tls_multi)
static void route_quota_inc(struct multi_instance *mi)
struct in6_addr local_ipv6
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * tls_username(const struct tls_multi *multi, const bool null)
Returns the username field for the given tunnel.
void multi_init(struct multi_context *m, struct context *t, bool tcp_mode)
struct buffer_list * cc_config
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
struct context top
Storage structure for process-wide configuration.
void mbuf_add_item(struct mbuf_set *ms, const struct mbuf_item *item)
static bool management_kill_by_cid(void *arg, const unsigned long cid, const char *kill_msg)
void multi_reap_process_dowork(const struct multi_context *m)
void tls_lock_common_name(struct tls_multi *multi)
Locks the common name field for the given tunnel.
void encrypt_sign(struct context *c, bool comp_frag)
Process a data channel packet that will be sent through a VPN tunnel.
enum client_connect_return(* multi_client_connect_handler)(struct multi_context *m, struct multi_instance *mi, bool from_deferred, unsigned int *option_types_found)
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...
static void multi_connection_established(struct multi_context *m, struct multi_instance *mi)
uint8_t addr[OPENVPN_ETH_ALEN]
static void multi_reap_free(struct multi_reap *mr)
static void hash_add_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv, void *value)
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...
void status_reset(struct status_output *so)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
int ifconfig_ipv6_netbits
bool push_ifconfig_ipv6_defined
void tunnel_server_tcp(struct context *top)
Main event loop for OpenVPN in TCP server mode.
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
#define MPP_CONDITIONAL_PRE_SELECT
#define ALLOC_OBJ(dptr, type)
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 bool buf_write_u8(struct buffer *dest, uint8_t data)
struct compress_options comp
bool multi_process_timeout(struct multi_context *m, const unsigned int mpp_flags)
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
static uint32_t cid_hash_function(const void *key, uint32_t iv)
void tunnel_server(struct context *top)
Main event loop for OpenVPN in server mode.
unsigned int imported_protocol_flags
void multi_close_instance(struct multi_context *m, struct multi_instance *mi, bool shutdown)
struct key_state key[KS_SIZE]
static bool multi_client_generate_tls_keys(struct context *c)
Generates the data channel keys.
void ungenerate_prefix(struct multi_instance *mi)
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 mroute_addr_init(struct mroute_addr *addr)
bool multi_tcp_instance_specific_init(struct multi_context *m, struct multi_instance *mi)
struct buffer_entry * next
void plugin_return_free(struct plugin_return *pr)
void mbuf_free(struct mbuf_set *ms)
void reschedule_multi_process(struct context *c)
Reschedule tls_multi_process.
static void multi_push_restart_schedule_exit(struct multi_context *m, bool next_server)
counter_type dco_write_bytes
#define OPENVPN_PLUGIN_FUNC_DEFERRED
bool push_ifconfig_defined
static void perf_pop(void)
static void multi_instance_inc_refcount(struct multi_instance *mi)
int16_t vlan_decapsulate(const struct context *c, struct buffer *buf)
struct hash_element * hash_lookup_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint32_t hv)
struct options options
Options loaded from command line or configuration file.
struct buffer outgoing
Buffer containing the remaining parts of the fragmented packet being sent.
struct multi_instance ** mpp_touched
bool do_deferred_options(struct context *c, const unsigned int found)
bool push_ifconfig_constraint_defined
void status_printf(struct status_output *so, const char *format,...)
in_addr_t push_ifconfig_local_alias
int dco_peer_id
This is the handle that DCO uses to identify this session with the kernel.
static void multi_schedule_context_wakeup(struct multi_context *m, struct multi_instance *mi)
void throw_signal(const int signum)
Throw a hard signal.
unsigned int cache_generation
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)
static bool is_cas_pending(enum multi_status cas)
struct hash * hash
VPN tunnel instances indexed by real address of the remote peer.
struct in6_addr reporting_addr_ipv6
void(* show_net)(void *arg, const int msglevel)
struct multi_instance * instance
in_addr_t ifconfig_pool_netmask
static void multi_select_virtual_addr(struct multi_context *m, struct multi_instance *mi)
struct multi_instance * pending
int push_ifconfig_ipv6_netbits
struct frame frame_fragment
int push_ifconfig_ipv6_netbits
static struct multi_reap * multi_reap_new(int buckets_per_pass)
bool multi_process_post(struct multi_context *m, struct multi_instance *mi, const unsigned int flags)
Perform postprocessing of a VPN tunnel instance.
@ OVPN_DEL_PEER_REASON_USERSPACE
void ifconfig_pool_write(struct ifconfig_pool_persist *persist, const struct ifconfig_pool *pool)
int stale_routes_check_interval
bool mroute_extract_openvpn_sockaddr(struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port)
struct hash * vhash
VPN tunnel instances indexed by virtual address of remote hosts.
static struct link_socket_info * get_link_socket_info(struct context *c)
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)
Update TLS session crypto parameters (cipher and auth) and derive data channel keys based on the supp...
Wrapper structure for dynamically allocated memory.
struct multi_instance * multi_create_instance(struct multi_context *m, const struct mroute_addr *real)
#define PERF_PROC_IN_LINK
struct multi_instance * earliest_wakeup
struct multi_instance * multi_get_create_instance_udp(struct multi_context *m, bool *floated)
Get, and if necessary create, the multi_instance associated with a packet's source address.
int dco_set_peer(dco_context_t *dco, unsigned int peerid, int keepalive_interval, int keepalive_timeout, int mss)
static struct multi_instance * multi_get_instance_by_virtual_addr(struct multi_context *m, const struct mroute_addr *addr, bool cidr_routing)
struct in6_addr push_ifconfig_ipv6_remote
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.
static bool plugin_return_defined(const struct plugin_return *pr)
ifconfig_pool_handle vaddr_handle
void tls_lock_cert_hash_set(struct tls_multi *multi)
Locks the certificate hash set used in the given tunnel.
#define CO_USE_DYNAMIC_TLS_CRYPT
Bit-flag indicating that renegotiations are using tls-crypt with a TLS-EKM derived key.
void hash_iterator_delete_element(struct hash_iterator *hi)
bool tls_authenticate_key(struct tls_multi *multi, const unsigned int mda_key_id, const bool auth, const char *client_reason)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
struct link_socket_actual actual
void schedule_remove_entry(struct schedule *s, struct schedule_entry *e)
char msg_prefix[MULTI_PREFIX_MAX_LENGTH]
bool(* client_pending_auth)(void *arg, const unsigned long cid, const unsigned int kid, const char *extra, unsigned int timeout)
static void multi_set_pending(struct multi_context *m, struct multi_instance *mi)
@ OVPN_DEL_PEER_REASON_EXPIRED
static void check_stale_routes(struct multi_context *m)
static void dco_delete_iroutes(struct multi_context *m, struct multi_instance *mi)
Security parameter state of a single session within a VPN tunnel.
struct env_set * env_set_create(struct gc_arena *gc)
void(* status)(void *arg, const int version, struct status_output *so)
struct timeval timeval
Time to next event of timers and similar.
int signal_reset(struct signal_info *si, int signum)
Clear the signal if its current value equals signum.
bool status_close(struct status_output *so)
struct link_socket * link_socket
static void multi_client_connect_late_setup(struct multi_context *m, struct multi_instance *mi, const unsigned int option_types_found)
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 management_connection_established(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
bool force_key_material_export
static void multi_reap_range(const struct multi_context *m, int start_bucket, int end_bucket)
struct mbuf_buffer * mbuf_alloc_buf(const struct buffer *buf)
void inherit_context_child(struct context *dest, const struct context *src)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
#define TUNNEL_TOPOLOGY(tt)
static void tv_add(struct timeval *dest, const struct timeval *src)
static int management_callback_kill_by_cn(void *arg, const char *del_cn)
const char * client_config_dir
#define PIPV6_ICMP_NOHOST_SERVER
void initial_rate_limit_free(struct initial_packet_rate_limit *irl)
free the initial-packet rate limiter structure
Garbage collection arena used to keep track of dynamically allocated memory.
static int mbuf_maximum_queued(const struct mbuf_set *ms)
struct signal_info * sig
Internal error signaling object.
struct iroute_ipv6 * next
const char * mroute_addr_print(const struct mroute_addr *ma, struct gc_arena *gc)
void setenv_str(struct env_set *es, const char *name, const char *value)
bool ifconfig_pool_write_trigger(struct ifconfig_pool_persist *persist)
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.
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
#define IV_PROTO_DYN_TLS_CRYPT
Support to dynamic tls-crypt (renegotiation with TLS-EKM derived tls-crypt key)
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)
static enum client_connect_return multi_client_connect_script_deferred(struct multi_context *m, struct multi_instance *mi, unsigned int *option_types_found)
static void strncpynt(char *dest, const char *src, size_t maxlen)
void status_flush(struct status_output *so)
struct auth_deferred_status plugin_auth
void multi_tcp_free(struct multi_tcp *mtcp)
static bool cid_compare_function(const void *key1, const void *key2)
void setenv_in6_addr(struct env_set *es, const char *name_prefix, const struct in6_addr *addr, const unsigned int flags)
Main OpenVPN server state structure.
struct argv argv_new(void)
Allocates a new struct argv and ensures it is initialised.
void inherit_context_top(struct context *dest, const struct context *src)
void free_context_buffers(struct context_buffers *b)
void init_management_callback_multi(struct multi_context *m)
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
bool argv_printf(struct argv *argres, const char *format,...)
printf() variant which populates a struct argv.
void multi_top_init(struct multi_context *m, struct context *top)
void ifconfig_pool_free(struct ifconfig_pool *pool)
static bool check_debug_level(unsigned int level)
void plugin_return_get_column(const struct plugin_return *src, struct plugin_return *dest, const char *colname)
static const multi_client_connect_handler client_connect_handlers[]
void hash_free(struct hash *hash)
struct mroute_addr::@1::@4 v6
in_addr_t ifconfig_pool_end
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 bool multi_output_queue_ready(const struct multi_context *m, const struct multi_instance *mi)
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...
static void management_delete_event(void *arg, event_t event)
client_connect_return
Return values used by the client connect call-back functions.
void send_restart(struct context *c, const char *kill_msg)
struct schedule * schedule_init(void)
struct man_def_auth_context mda_context
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.
uint16_t mss_fix
The actual MSS value that should be written to the payload packets.
struct hash * iter
VPN tunnel instances indexed by real address of the remote peer, optimized for iteration.
#define IV_PROTO_NCP_P2P
Support doing NCP in P2P mode.
struct multi_tcp * multi_tcp_init(int maxevents, int *maxclients)
bool ifconfig_pool_defined
#define OPENVPN_PLUGIN_CLIENT_DISCONNECT
void mroute_helper_add_iroute46(struct mroute_helper *mh, int netbits)
struct auth_deferred_status script_auth
unsigned int option_types_found
struct fragment_master * fragment
void mbuf_free_buf(struct mbuf_buffer *mb)
static bool is_exit_restart(int sig)
counter_type dco_read_bytes
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
static char * management_get_peer_info(void *arg, const unsigned long cid)
void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags)
void auth_set_client_reason(struct tls_multi *multi, const char *client_reason)
Sets the reason why authentication of a client failed.
in_addr_t push_ifconfig_remote_netmask
const char * print_link_socket_actual(const struct link_socket_actual *act, struct gc_arena *gc)
in_addr_t push_ifconfig_remote_netmask
static int min_int(int x, int y)
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 gc_free(struct gc_arena *a)
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 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...
bool mroute_addr_compare_function(const void *key1, const void *key2)
static void multi_reap_all(const struct multi_context *m)
unsigned int cache_generation
static int management_callback_kill_by_addr(void *arg, const in_addr_t addr, const int port)
static void multi_client_connect_early_setup(struct multi_context *m, struct multi_instance *mi)
@ KS_AUTH_DEFERRED
Key state authentication is being deferred, by async auth.
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...
int ifconfig_ipv6_pool_netbits
const char * multi_instance_string(const struct multi_instance *mi, bool null, struct gc_arena *gc)
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.
static bool multi_route_defined(const struct multi_context *m, const struct multi_route *r)
int max_routes_per_client
#define ALLOC_OBJ_CLEAR(dptr, type)
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
#define MULTI_ROUTE_CACHE
time_t created
Time at which a VPN tunnel instance was created.
bool mroute_learnable_address(const struct mroute_addr *addr, struct gc_arena *gc)
struct frequency_limit * frequency_limit_init(int max, int per)
struct status_output * status_output
@ CAS_PENDING_DEFERRED_PARTIAL
at least handler succeeded but another is still pending
#define OPENVPN_PLUGIN_FUNC_SUCCESS
in_addr_t ifconfig_pool_start
@ OVPN_DEL_PEER_REASON_TRANSPORT_DISCONNECT
void multi_add_mbuf(struct multi_context *m, struct multi_instance *mi, struct mbuf_buffer *mb)
#define MROUTE_EXTRACT_BCAST
struct link_socket_actual from
const char * time_string(time_t t, int usec, bool show_usec, struct gc_arena *gc)
static void multi_route_del(struct multi_route *route)
struct ifconfig_pool_persist * ifconfig_pool_persist
void buffer_list_free(struct buffer_list *ol)
Frees a buffer list and all the buffers in it.
bool multi_process_incoming_link(struct multi_context *m, struct multi_instance *instance, const unsigned int mpp_flags)
Demultiplex and process a packet received over the external network interface.
struct initial_packet_rate_limit * initial_rate_limiter
char * remote_ciphername
cipher specified in peer's config file
int(* kill_by_addr)(void *arg, const in_addr_t addr, const int port)
struct client_connect_defer_state client_connect_defer_state
Container for bidirectional cipher and HMAC key material.
struct mbuf_buffer * buffer
void frequency_limit_free(struct frequency_limit *f)
void management_set_callback(struct management *man, const struct management_callback *cb)
struct multi_tcp * mtcp
State specific to OpenVPN using TCP as external transport.
struct in6_addr ifconfig_ipv6_pool_base
#define IA_EMPTY_IF_UNDEF
void management_learn_addr(struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
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)
#define TM_INITIAL
As yet un-trusted tls_session being negotiated.
const char * client_disconnect_script
int dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m)
static int dco_multi_add_new_peer(struct multi_context *m, struct multi_instance *mi)
int stale_routes_ageing_time
static int hash_n_buckets(const struct hash *hash)
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.
#define MROUTE_EXTRACT_MCAST
bool push_ifconfig_ipv6_defined
bool plugin_defined(const struct plugin_list *pl, const int type)
void mroute_addr_mask_host_bits(struct mroute_addr *ma)
struct iroute_ipv6 * iroutes_ipv6
static int constrain_int(int x, int min, int max)
struct openvpn_sockaddr dest
void mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance *mi)
void remap_signal(struct context *c)
#define MROUTE_EXTRACT_SUCCEEDED
in_addr_t push_ifconfig_local_alias
#define MULTI_PREFIX_MAX_LENGTH
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.
in_addr_t push_ifconfig_constraint_network
#define CO_USE_TLS_KEY_MATERIAL_EXPORT
Bit-flag indicating that data channel key derivation is done using TLS keying material export [RFC570...
void(* delete_event)(void *arg, event_t event)
void setenv_del(struct env_set *es, const char *name)
static void management_callback_status(void *arg, const int version, struct status_output *so)
static int management_callback_n_clients(void *arg)
struct ifconfig_pool * ifconfig_pool
in_addr_t push_ifconfig_local
static bool multi_client_setup_dco_initial(struct multi_context *m, struct multi_instance *mi, struct gc_arena *gc)
const char * learn_address_script
struct mbuf_set * mbuf_init(unsigned int size)
void process_incoming_tun(struct context *c)
Process a packet read from the virtual tun/tap network interface.
void multi_top_free(struct multi_context *m)
static void update_mstat_n_clients(const int n_clients)
const char title_string[]
bool ifconfig_pool_release(struct ifconfig_pool *pool, ifconfig_pool_handle hand, const bool hard)
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...
void multi_tcp_instance_specific_free(struct multi_instance *mi)
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)
void multi_tcp_delete_event(struct multi_tcp *mtcp, event_t event)
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
static void multi_client_disconnect_setenv(struct multi_context *m, struct multi_instance *mi)
void ifconfig_pool_read(struct ifconfig_pool_persist *persist, struct ifconfig_pool *pool)
#define OPENVPN_PLUGIN_CLIENT_CONNECT
void multi_process_float(struct multi_context *m, struct multi_instance *mi)
Handles peer floating.
#define IV_PROTO_CC_EXIT_NOTIFY
Support for explicit exit notify via control channel This also includes support for the protocol-flag...
void setenv_long_long(struct env_set *es, const char *name, long long value)
static void dco_install_iroute(struct multi_context *m, struct multi_instance *mi, struct mroute_addr *addr)
static void multi_add_iroutes(struct multi_context *m, struct multi_instance *mi)
void hash_iterator_init_range(struct hash *hash, struct hash_iterator *hi, int start_bucket, int end_bucket)
bool vlan_is_tagged(const struct buffer *buf)
static void perf_push(int type)
bool buf_printf(struct buffer *buf, const char *format,...)
bool multi_process_signal(struct multi_context *m)
void multi_print_status(struct multi_context *m, struct status_output *so, const int version)
struct context context
The context structure storing state for this VPN tunnel.
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.
struct buffer_entry * head
static void multi_delete_dup(struct multi_context *m, struct multi_instance *new_mi)
void schedule_free(struct schedule *s)
void setenv_in_addr_t(struct env_set *es, const char *name_prefix, in_addr_t addr, const unsigned int flags)
static void mroute_extract_in_addr_t(struct mroute_addr *dest, const in_addr_t src)
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
in_addr_t push_ifconfig_constraint_netmask
static uint32_t hash_value(const struct hash *hash, const void *key)
Security parameter state for processing data channel packets.
struct context_1 c1
Level 1 context.
const char * tls_common_name(const struct tls_multi *multi, const bool null)
Returns the common name field for the given tunnel.
void close_context(struct context *c, int sig, unsigned int flags)
static bool mroute_addr_equal(const struct mroute_addr *a1, const struct mroute_addr *a2)
int(* n_clients)(void *arg)
int dev_type_enum(const char *dev, const char *dev_type)
int process_incoming_push_request(struct context *c)
#define OPENVPN_PLUGIN_CLIENT_CONNECT_DEFER_V2
uint8_t * data
Pointer to the allocated memory.
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
static void multi_reap_process(const struct multi_context *m)
static int cleanup(void **state)