31#include <systemd/sd-daemon.h>
68#define CF_LOAD_PERSISTED_PACKET_ID (1<<0)
69#define CF_INIT_TLS_MULTI (1<<1)
70#define CF_INIT_TLS_AUTH_STANDALONE (1<<2)
116 const char *dev_type,
118 const char *ifconfig_local,
119 const char *ifconfig_remote,
121 const char *signal_text,
122 const char *script_type,
146 if (!ifconfig_remote)
148 ifconfig_remote =
"";
161 arg, tun_mtu, ifconfig_local, ifconfig_remote,
context);
163 if (
plugin_call(plugins, plugin_type, &
argv, NULL,
es) != OPENVPN_PLUGIN_FUNC_SUCCESS)
165 msg(
M_FATAL,
"ERROR: up/down plugin call failed");
178 ifconfig_local, ifconfig_remote,
context);
209#ifdef ENABLE_MANAGEMENT
219 if (
streq(p[1],
"NONE"))
223 else if (p[2] && p[3])
225 if (
streq(p[1],
"HTTP"))
230 msg(
M_WARN,
"HTTP proxy support only works for TCP based connections");
239 else if (
streq(p[1],
"SOCKS"))
251 ce->
flags &= ~CE_MAN_QUERY_PROXY;
270 buf_printf(&out,
">PROXY:%u,%s,%s", (
l ?
l->current : 0) + 1,
312 size_t len = strlen(command) + 1 + strlen(parameters) + 1;
360 char *out = malloc(len);
369 msg(
M_WARN,
"Out of bounds index in management query for remote entry: index = %u", index);
384 if (!strcmp(p[1],
"ACCEPT"))
389 else if (!strcmp(p[1],
"SKIP"))
395 else if (!strcmp(p[1],
"MOD") && p[2] && p[3])
428 int ce_changed =
true;
486 if (
c->options.remote_random)
489 for (
i =
l->len - 1;
i > 0; --
i)
576 int advance_count = 1;
600 msg(
M_FATAL,
"No usable connection profiles are present");
616#ifdef ENABLE_MANAGEMENT
635 }
while (!ce_defined);
641 msg(
M_FATAL,
"All connections have been connect-retry-max (%d) times unsuccessful, exiting",
663#ifdef ENABLE_MANAGEMENT
698 bool did_http =
false;
759#if defined(ENABLE_PKCS11)
763 pkcs11_initialize(
true, c->
options.pkcs11_pin_cache_period);
766 pkcs11_addProvider(c->
options.pkcs11_providers[i], c->
options.pkcs11_protected_authentication[i],
767 c->
options.pkcs11_private_mode[i], c->
options.pkcs11_cert_private[i]);
779 strcpy(up.
username,
"Please insert your cryptographic token");
791 sd_notifyf(0,
"READY=1\nSTATUS=Pre-connection initialization successful\nMAINPID=%lu",
792 (
unsigned long) getpid());
808close_port_share(
void)
812 port_share_close(port_share);
818init_port_share(
struct context *c)
820 if (!port_share && (c->
options.port_share_host && c->
options.port_share_port))
822 port_share = port_share_open(c->
options.port_share_host,
825 c->
options.port_share_journal_dir);
826 if (port_share == NULL)
828 msg(
M_FATAL,
"Fatal error: Port sharing failed");
840 crypto_init_dmalloc();
851 if (!gettimeofday(&tv, NULL))
853 const unsigned int seed = (
unsigned int) tv.tv_sec ^ tv.tv_usec;
864#ifdef OPENVPN_DEBUG_COMMAND_LINE
867 for (i = 0; i < argc; ++i)
883#ifdef IFCONFIG_POOL_TEST
884 ifconfig_pool_test(0x0A010004, 0x0A0100FF);
896 const char *fn = gen_path(
"foo",
905#ifdef STATUS_PRINTF_TEST
914 msg(
M_WARN,
"STATUS_PRINTF_TEST: %s: write error", tmp_file);
924 mstats_open(
"/dev/shm/mstats.dat");
925 for (i = 0; i < 30; ++i)
927 mmap_stats->n_clients += 1;
928 mmap_stats->link_write_bytes += 8;
929 mmap_stats->link_read_bytes += 16;
953#if defined(MEASURE_TLS_HANDSHAKE_STATS)
954 show_tls_performance_stats();
1046 msg(
M_USAGE,
"Using --genkey type with --secret filename is "
1047 "not supported. Use --genkey type filename instead.");
1055 msg(
M_USAGE,
"You must provide a filename to either --genkey "
1056 "or --secret, not both");
1065 msg(
M_WARN,
"WARNING: Using --genkey --secret filename is "
1066 "DEPRECATED. Use --genkey secret filename instead.");
1071 if (nbits_written < 0)
1077 "Randomly generated %d bit key written to %s", nbits_written,
1091 "--genkey tls-crypt-v2-client requires a server key to be set via --tls-crypt-v2 to create a client key");
1130 "options --mktun or --rmtun should only be used together with --dev");
1133#if defined(ENABLE_DCO)
1145 msg(
M_WARN,
"Note: --mktun does not support DCO. Creating TUN interface.");
1152#ifdef ENABLE_FEATURE_TUN_PERSIST
1164 "options --mktun and --rmtun are not available on your operating "
1165 "system. Please check 'man tun' (or 'tap'), whether your system "
1166 "supports using 'ifconfig %s create' / 'destroy' to create/remove "
1167 "persistent tunnel interfaces.",
options->
dev );
1181#ifdef ENABLE_SYSTEMD
1183 if (sd_notify(0,
"READY=0") > 0)
1193#if defined(__APPLE__) && defined(__clang__)
1194#pragma clang diagnostic push
1195#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1199 msg(
M_ERR,
"daemon() failed or unsupported");
1201#if defined(__APPLE__) && defined(__clang__)
1202#pragma clang diagnostic pop
1221 static const char why_not[] =
"will be delayed because of --client, --pull, or --up-delay";
1235 msg(
M_INFO,
"NOTE: chroot %s", why_not);
1250 msg(
M_INFO,
"NOTE: UID/GID downgrade %s", why_not);
1254#ifdef ENABLE_MEMSTATS
1257 mstats_open(c->
options.memstats_fn);
1261#ifdef ENABLE_SELINUX
1268 if (c->
options.selinux_context)
1272 if (-1 == setcon(c->
options.selinux_context))
1274 msg(
M_ERR,
"setcon to '%s' failed; is /proc accessible?", c->
options.selinux_context);
1283 msg(
M_INFO,
"NOTE: setcon %s", why_not);
1306 if (
c->c2.tls_multi)
1344 c->c2.coarse_timer_wakeup = 0;
1356 if (
c->options.ce.connect_timeout)
1372 if (
c->options.inactivity_timeout)
1378 if (
c->options.session_timeout)
1393 if (
c->options.ping_send_timeout)
1398 if (
c->options.ping_rec_timeout)
1409 if (
c->options.auth_token_generate
1410 &&
c->options.auth_token_renewal <
c->options.renegotiate_seconds)
1413 c->options.auth_token_renewal,
now);
1425 &&
c->c2.options_string_local &&
c->c2.options_string_remote)
1430 if (
c->options.mtu_test)
1436 if (
c->options.packet_id_file)
1454 if (
c->options.shaper)
1469 if (!
c->c1.route_list)
1473 if (
c->options.routes_ipv6 && !
c->c1.route_ipv6_list)
1561 char *
opt_list[] = {
"::/3",
"2000::/4",
"3000::/4",
"fc00::/7",
NULL };
1592 static const char message[] =
"Initialization Sequence Completed";
1595 c->options.unsuccessful_attempts = 0;
1606 msg(
M_INFO,
"%s With Errors ( see http://openvpn.net/faq.html#dhcpclientserv )",
message);
1608#ifdef ENABLE_SYSTEMD
1616#ifdef ENABLE_SYSTEMD
1625 c->options.no_advance =
true;
1632#ifdef ENABLE_MANAGEMENT
1637 struct in6_addr *tun_local6 = NULL;
1640 socklen_t sa_len =
sizeof(local);
1641 const char *detail =
"SUCCESS";
1649#if defined(_WIN32) || defined(ENABLE_SITNL)
1652 detail =
"ROUTE_ERROR";
1658 remote = actual->
dest;
1660#if ENABLE_IP_PKTINFO
1663 switch (local.
addr.
sa.sa_family)
1666#if defined(HAVE_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST)
1667 local.
addr.
in4.sin_addr = actual->pi.in4.ipi_spec_dst;
1669 local.
addr.
in4.sin_addr = actual->pi.in4;
1674 local.
addr.
in6.sin6_addr = actual->pi.in6.ipi6_addr;
1732#ifdef ENABLE_MANAGEMENT
1741 if (
plugin_call(plugins, OPENVPN_PLUGIN_ROUTE_UP, NULL, NULL,
es) != OPENVPN_PLUGIN_FUNC_SUCCESS)
1743 msg(
M_WARN,
"WARNING: route-up plugin call failed");
1836#ifdef TARGET_ANDROID
1860 BOOL dns_only = !block_local;
1885 msg(
M_FATAL,
"WFP: deinitialization failed");
1935#ifdef TARGET_ANDROID
1961 msg(
D_ROUTE,
"interactive service msg_channel=%" PRIuPTR,
2002#ifdef TARGET_ANDROID
2061 msg(
M_INFO,
"Preserving previous TUN/TAP instance: %s",
2150 unsigned long adapter_index = 0;
2159#ifdef ENABLE_MANAGEMENT
2173 OPENVPN_PLUGIN_ROUTE_PREDOWN,
2203 OPENVPN_PLUGIN_DOWN,
2233 OPENVPN_PLUGIN_DOWN,
2290 if (
buf_len(buf) > strlen(header))
2313 buf_printf(&out,
"Data Channel: cipher '%s'",
2318 buf_printf(&out,
"Data Channel: cipher '%s', auth '%s'",
2328 if (
c->c2.comp_context)
2330 buf_printf(&out,
", compression: '%s'",
c->c2.comp_context->alg.name);
2338 const char *header =
"Timers: ";
2342 if (
o->ping_send_timeout)
2344 buf_printf(&out,
"ping %d",
o->ping_send_timeout);
2354 buf_printf(&out,
"ping-exit %d",
o->ping_rec_timeout);
2358 buf_printf(&out,
"ping-restart %d",
o->ping_rec_timeout);
2362 if (
o->inactivity_timeout)
2366 buf_printf(&out,
"inactive %d",
o->inactivity_timeout);
2367 if (
o->inactivity_minimum_bytes)
2373 if (
o->session_timeout)
2376 buf_printf(&out,
"session-timeout %d",
o->session_timeout);
2385 header =
"Protocol options: ";
2388 if (
c->options.ce.explicit_exit_notification)
2391 c->options.ce.explicit_exit_notification);
2393 if (
c->options.imported_protocol_flags)
2434 struct frame *frame_fragment = NULL;
2435#ifdef ENABLE_FRAGMENT
2457do_up(
struct context *c,
bool pulled_options,
unsigned int option_types_found)
2459 int error_flags = 0;
2490 msg(
M_INFO,
"NOTE: Pulled options changed on restart, will need to close and reopen TUN/TAP device.");
2497 msg(
M_NONFATAL,
"dco-win doesn't yet support reopening TUN device");
2526 msg(
D_DCO,
"Cannot add peer to DCO: %s (%d)", strerror(-ret), ret);
2550 msg(
D_TLS_ERRORS,
"ERROR: Failed to apply P2P negotiated protocol options");
2594 unsigned int flags =
2642 "--data-ciphers-fallback not enabled. No usable "
2643 "data channel cipher");
2647 struct frame *frame_fragment = NULL;
2648#ifdef ENABLE_FRAGMENT
2675 msg(
D_PUSH,
"OPTIONS IMPORT: --verb and/or --mute level changed");
2689 msg(
D_PUSH,
"OPTIONS IMPORT: --explicit-exit-notify can only be used with --proto udp");
2694 msg(
D_PUSH_DEBUG,
"OPTIONS IMPORT: explicit notify parm(s) modified");
2703 "settings that are not allowed and will result "
2704 "in a non-working connection. "
2705 "See also allow-compression in the manual.");
2710 comp_uninit(c->
c2.comp_context);
2717 msg(
D_PUSH,
"OPTIONS IMPORT: traffic shaper enabled");
2723 msg(
D_PUSH,
"OPTIONS IMPORT: --sndbuf/--rcvbuf options modified");
2735 msg(
D_PUSH,
"OPTIONS IMPORT: --socket-flags option modified");
2745 msg(
D_PUSH,
"OPTIONS IMPORT: --persist options modified");
2749 msg(
D_PUSH,
"OPTIONS IMPORT: --ifconfig/up options modified");
2753 msg(
D_PUSH,
"OPTIONS IMPORT: route options modified");
2757 msg(
D_PUSH,
"OPTIONS IMPORT: route-related options modified");
2761 msg(
D_PUSH,
"OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified");
2765 msg(
D_PUSH,
"OPTIONS IMPORT: environment modified");
2788 "with data channel offload. Use --disable-dco to connect to "
2799 if (epoch_data && !datav2_enabled)
2802 "data v2 (peer-id) to be enabled.");
2818 "tun-mtu-max %d in the client configuration",
2834#ifdef ENABLE_MANAGEMENT
2869 if (GREMLIN_CONNECTION_FLOOD_LEVEL(c->
options.gremlin))
3039 msg(
D_MTU_DEBUG,
"MTU: adding %zu buffer tailroom for compression for %zu "
3082#ifdef ENABLE_PREDICTION_RESISTANCE
3083 if (c->
options.use_prediction_resistance)
3085 rand_ctx_enable_prediction_resistance();
3132 msg(
M_INFO,
"Re-using pre-shared static key");
3156 msg(
M_FATAL,
"ERROR: tls-auth enabled, but no valid --auth "
3165 "Control Channel Authentication",
"tls-auth",
3205 msg(
M_WARN,
"ERROR: tls-crypt-v2 client key too large to work with "
3206 "requested --max-packet-size %d, requires at least "
3207 "--max-packet-size %d. Packets will ignore requested "
3237 msg(
M_FATAL,
"Error: private key password verification failed");
3322 bool packet_id_long_form;
3351 if (packet_id_long_form)
3432#ifdef ENABLE_X509ALTUSERNAME
3446#ifdef ENABLE_MANAGEMENT
3469#ifdef ENABLE_MANAGEMENT
3477#ifdef HAVE_EXPORT_KEYING_MATERIAL
3478 if (
options->keying_material_exporter_label)
3564 "Control Channel MTU parms");
3574 "TLS-Auth MTU parms");
3594 "******* WARNING *******: All encryption and authentication features "
3595 "disabled -- All data will be tunnelled as clear text and will not be "
3596 "protected against man-in-the-middle changes. "
3597 "PLEASE DO RECONSIDER THIS CONFIGURATION!");
3635#if defined(ENABLE_FRAGMENT)
3642 "WARNING: using --fragment and --mtu-test together may produce an inaccurate MTU test result");
3646#ifdef ENABLE_FRAGMENT
3649 msg(
M_WARN,
"WARNING: if you use --mssfix and --fragment, you should "
3650 "set --fragment (%d) larger or equal than --mssfix (%d)",
3656 msg(
M_WARN,
"WARNING: if you use --mssfix and --fragment, you should "
3657 "use the \"mtu\" flag for both or none of of them.");
3669 msg(
M_WARN,
"WARNING: --ping should normally be used with --ping-restart or --ping-exit");
3673#ifdef ENABLE_SELINUX
3674 || o->selinux_context
3680 msg(
M_WARN,
"WARNING: you are using user/group/chroot/setcon without persist-tun -- this may cause restarts to fail");
3686 msg(
M_WARN,
"WARNING: you are using chroot without specifying user and group -- this may cause the chroot jail to be insecure");
3691 msg(
M_WARN,
"WARNING: using --pull/--client and --ifconfig together is probably not what you want");
3696 msg(
M_WARN,
"NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to");
3703 msg(
M_WARN,
"WARNING: using --duplicate-cn and --client-config-dir together is probably not what you want");
3707 msg(
M_WARN,
"WARNING: --ifconfig-pool-persist will not work with --duplicate-cn");
3711 msg(
M_WARN,
"WARNING: --keepalive option is missing from server config");
3726 msg(
M_WARN,
"WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.");
3730 msg(
M_WARN,
"WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.");
3738 msg(
M_WARN,
"NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
3742 msg(
M_WARN,
"WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
3746 msg(
M_WARN,
"NOTE: starting with " PACKAGE_NAME
" 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");
3770 b->decompress_buf =
alloc_buf(buf_size);
3808#ifdef ENABLE_FRAGMENT
3900#ifdef ENABLE_FRAGMENT
3904 "Fragmentation MTU parms");
3927 msg(
D_SHOW_OCC,
"Expected Remote Options String (VER=%s): '%s'",
4117#ifdef ENABLE_FRAGMENT
4138 bool need_us_timeout)
4140 unsigned int flags = 0;
4146 if (need_us_timeout)
4263 msg(
M_INFO,
"NOTE: --fast-io is disabled since we are running on Windows");
4267 msg(
M_INFO,
"NOTE: --fast-io is disabled since we are using --shaper");
4316 for (i = 0; i < config.
n; ++i)
4318 unsigned int option_types_found = 0;
4319 if (config.
list[i] && config.
list[i]->value)
4322 config.
list[i]->value,
4325 &option_types_found,
4362#ifdef ENABLE_MANAGEMENT
4377 msg(msglevel,
"END");
4379 msg(msglevel,
"ERROR: Sorry, this command is currently only implemented on Windows");
4383#ifdef TARGET_ANDROID
4385management_callback_network_change(
void *arg,
bool samenetwork)
4436#ifdef ENABLE_MANAGEMENT
4447#ifdef TARGET_ANDROID
4448 cb.network_change = management_callback_network_change;
4457#ifdef ENABLE_MANAGEMENT
4506 msg(
M_WARN,
"Signal received from management interface, exiting");
4534#ifdef ENABLE_MANAGEMENT
4545#ifdef ENABLE_MANAGEMENT
4655 open_plugins(c,
false, OPENVPN_PLUGIN_INIT_PRE_DAEMON);
4705#ifdef ENABLE_FRAGMENT
4715 unsigned int crypto_flags = 0;
4755#ifdef ENABLE_FRAGMENT
4773 int error_flags = 0;
4799 open_plugins(c,
false, OPENVPN_PLUGIN_INIT_POST_DAEMON);
4839 open_plugins(c,
false, OPENVPN_PLUGIN_INIT_POST_UID_CHANGE);
4883 if (c->
c2.comp_context)
4885 comp_uninit(c->
c2.comp_context);
4886 c->
c2.comp_context = NULL;
4909#ifdef ENABLE_MANAGEMENT
4927#ifdef ENABLE_FRAGMENT
5079 dest->
c2.comp_context = NULL;
5120 unsigned int pid = 0;
5124 msg(
M_ERR,
"Open error on pid file %s", filename);
5129 fprintf(fp,
"%u\n", pid);
5132 msg(
M_ERR,
"Close error on pid file %s", filename);
5142 msg(
M_FATAL,
"Failed allocate memory saved_pid_file_name");
void argv_msg(const int msglev, const struct argv *a)
Write the arguments stored in a struct argv via the msg() command.
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 auth_token_write_server_key_file(const char *filename)
Generate a auth-token server secret key, and write to file.
void auth_token_init_secret(struct key_ctx *key_ctx, const char *key_file, bool key_inline)
Loads an HMAC secret from a file or if no file is present generates a epheremal secret for the run ti...
void free_buf(struct buffer *buf)
void buf_clear(struct buffer *buf)
bool buf_printf(struct buffer *buf, const char *format,...)
void string_clear(char *str)
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
struct buffer alloc_buf(size_t size)
char * string_alloc(const char *str, struct gc_arena *gc)
static void gc_detach(struct gc_arena *a)
#define ALLOC_ARRAY_GC(dptr, type, n, gc)
#define ALLOC_ARRAY_CLEAR_GC(dptr, type, n, gc)
static void gc_init(struct gc_arena *a)
static void buf_set_write(struct buffer *buf, uint8_t *data, int size)
static int buf_len(const struct buffer *buf)
#define ALLOC_OBJ_CLEAR_GC(dptr, type, gc)
#define ALLOC_OBJ_GC(dptr, type, gc)
static void strncpynt(char *dest, const char *src, size_t maxlen)
static void check_malloc_return(void *p)
static void gc_free(struct gc_arena *a)
#define ALLOC_OBJ_CLEAR(dptr, type)
static struct gc_arena gc_new(void)
bool check_compression_settings_valid(struct compress_options *info, int msglevel)
Checks if the compression settings are valid.
char * basename(char *filename)
int daemon(int nochdir, int noclose)
void free_key_ctx_bi(struct key_ctx_bi *ctx)
long int get_random(void)
void init_key_type(struct key_type *kt, const char *ciphername, const char *authname, bool tls_mode, bool warn)
Initialize a key_type structure with.
int write_key_file(const int nkeys, const char *filename)
Write nkeys 1024-bits keys to file.
unsigned int crypto_max_overhead(void)
Return the worst-case OpenVPN crypto overhead (in bytes)
void test_crypto(struct crypto_options *co, struct frame *frame)
void crypto_read_openvpn_key(const struct key_type *key_type, struct key_ctx_bi *ctx, const char *key_file, bool key_inline, const int key_direction, const char *key_name, const char *opt_name, struct key2 *keydata)
void free_key_ctx(struct key_ctx *ctx)
#define CO_PACKET_ID_LONG_FORM
Bit-flag indicating whether to use OpenVPN's long packet ID format.
#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_MUTE_REPLAY_WARNINGS
Bit-flag indicating not to display replay warnings.
#define CO_FORCE_TLSCRYPTV2_COOKIE
Bit-flag indicating that we do not allow clients that do not support resending the wrapped client key...
#define CO_USE_CC_EXIT_NOTIFY
Bit-flag indicating that explicit exit notifies should be sent via the control channel instead of usi...
static bool key_ctx_bi_defined(const struct key_ctx_bi *key)
void show_available_engines(void)
bool cipher_kt_mode_aead(const char *ciphername)
Check if the supplied cipher is a supported AEAD mode cipher.
void show_available_ciphers(void)
bool md_valid(const char *digest)
Return if a message digest parameters is valid given the name of the digest.
bool cipher_kt_mode_ofb_cfb(const char *ciphername)
Check if the supplied cipher is a supported OFB or CFB mode cipher.
const char * md_kt_name(const char *mdname)
Retrieve a string describing the digest digest (e.g.
const char * cipher_kt_name(const char *ciphername)
Retrieve a normalised string describing the cipher (e.g.
void crypto_init_lib_engine(const char *engine_name)
void md_ctx_cleanup(md_ctx_t *ctx)
void show_available_digests(void)
void md_ctx_free(md_ctx_t *ctx)
#define DCO_DEFAULT_METRIC
static bool dco_supports_epoch_data(struct context *c)
static void dco_remove_peer(struct context *c)
static int dco_p2p_add_new_peer(struct context *c)
static bool ovpn_dco_init(int mode, dco_context_t *dco, const char *dev_node)
static bool dco_check_pull_options(int msglevel, const struct options *o)
void env_set_destroy(struct env_set *es)
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)
void env_set_inherit(struct env_set *es, const struct env_set *src)
struct env_set * env_set_create(struct gc_arena *gc)
#define P2P_ERROR_DELAY_MS
struct event_set * event_set_init(int *maxevents, unsigned int flags)
#define EVENT_METHOD_FAST
#define EVENT_METHOD_US_TIMEOUT
static void event_free(struct event_set *es)
bool send_control_channel_string(struct context *c, const char *str, int msglevel)
Interface functions to the internal and external multiplexers.
static struct link_socket_info * get_link_socket_info(struct context *c)
struct tls_auth_standalone * tls_auth_standalone_init(struct tls_options *tls_options, struct gc_arena *gc)
void tls_init_control_channel_frame_parameters(struct frame *frame, int tls_mtu)
void tls_multi_free(struct tls_multi *multi, bool clear)
Cleanup a tls_multi structure and free associated memory allocations.
struct tls_multi * tls_multi_init(struct tls_options *tls_options)
Allocate and initialize a tls_multi structure.
void tls_multi_init_finalize(struct tls_multi *multi, int tls_mtu)
Finalize initialization of a tls_multi structure.
void tls_auth_standalone_free(struct tls_auth_standalone *tas)
Frees a standalone tls-auth verification object.
#define TM_ACTIVE
Active tls_session.
void tls_multi_init_set_options(struct tls_multi *multi, const char *local, const char *remote)
void fragment_frame_init(struct fragment_master *f, const struct frame *frame)
Allocate internal packet buffers for a fragment_master structure.
struct fragment_master * fragment_init(struct frame *frame)
Allocate and initialize a fragment_master structure.
void fragment_free(struct fragment_master *f)
Free a fragment_master structure and its internal packet buffers.
void tls_crypt_init_key(struct key_ctx_bi *key, struct key2 *keydata, const char *key_file, bool key_inline, bool tls_server)
Initialize a key_ctx_bi structure for use with –tls-crypt.
void tls_crypt_v2_init_server_key(struct key_ctx *key_ctx, bool encrypt, const char *key_file, bool key_inline)
Initialize a tls-crypt-v2 server key (used to encrypt/decrypt client keys).
void tls_crypt_v2_write_client_key_file(const char *filename, const char *b64_metadata, const char *server_key_file, bool server_key_inline)
Generate a tls-crypt-v2 client key, and write to file.
void tls_crypt_v2_write_server_key_file(const char *filename)
Generate a tls-crypt-v2 server key, and write to file.
int tls_crypt_buf_overhead(void)
Returns the maximum overhead (in bytes) added to the destination buffer by tls_crypt_wrap().
void tls_crypt_v2_init_client_key(struct key_ctx_bi *key, struct key2 *original_key, struct buffer *wkc_buf, const char *key_file, bool key_inline)
Initialize a tls-crypt-v2 client key.
void uninit_management_callback(void)
static void uninit_proxy(struct context *c)
bool open_management(struct context *c)
static void do_init_first_time(struct context *c)
static void do_init_route_list(const struct options *options, struct route_list *route_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx)
static void do_init_tls_wrap_key(struct context *c)
static bool management_callback_remote_cmd(void *arg, const char **p)
bool do_genkey(const struct options *options)
static void next_connection_entry(struct context *c)
static bool can_preserve_tun(struct tuntap *tt)
void initialization_sequence_completed(struct context *c, const unsigned int flags)
void open_plugins(struct context *c, const bool import_options, int init_point)
static void do_setup_fast_io(struct context *c)
static void tls_print_deferred_options_results(struct context *c)
Prints the results of options imported for the data channel.
static const char * saved_pid_file_name
void init_verb_mute(struct context *c, unsigned int flags)
static void do_uid_gid_chroot(struct context *c, bool no_delay)
const char * format_common_name(struct context *c, struct gc_arena *gc)
static void do_close_link_socket(struct context *c)
static unsigned int management_callback_remote_entry_count(void *arg)
static void do_signal_on_tls_errors(struct context *c)
static void do_init_crypto_static(struct context *c, const unsigned int flags)
static void key_schedule_free(struct key_schedule *ks, bool free_ssl_ctx)
static void do_init_tun(struct context *c)
static void do_option_warnings(struct context *c)
void init_instance(struct context *c, const struct env_set *env, const unsigned int flags)
static void do_link_socket_addr_new(struct context *c)
void close_instance(struct context *c)
static void do_init_route_ipv6_list(const struct options *options, struct route_ipv6_list *route_ipv6_list, const struct link_socket_info *link_socket_info, struct env_set *es, openvpn_net_ctx_t *ctx)
static void do_init_frame(struct context *c)
void persist_client_stats(struct context *c)
void inherit_context_top(struct context *dest, const struct context *src)
void context_clear_1(struct context *c)
static bool ce_management_query_proxy(struct context *c)
static void do_init_crypto(struct context *c, const unsigned int flags)
static void do_init_frame_tls(struct context *c)
static void do_init_traffic_shaper(struct context *c)
static bool route_noexec_enabled(const struct options *o, const struct tuntap *tt)
Determine if external route commands should be executed based on configured options and backend drive...
static bool ifconfig_noexec_enabled(const struct context *c)
Determines if ifconfig execution should be disabled because of a.
static void clear_remote_addrlist(struct link_socket_addr *lsa, bool free)
bool do_test_crypto(const struct options *o)
static void do_print_data_channel_mtu_parms(struct context *c)
void init_plugins(struct context *c)
void free_context_buffers(struct context_buffers *b)
static void init_crypto_pre(struct context *c, const unsigned int flags)
static void do_init_timers(struct context *c, bool deferred)
#define CF_LOAD_PERSISTED_PACKET_ID
static void do_alloc_route_list(struct context *c)
static void do_close_status_output(struct context *c)
static void do_event_set_init(struct context *c, bool need_us_timeout)
static struct context * static_context
static void do_init_fragment(struct context *c)
#define CF_INIT_TLS_MULTI
void context_init_1(struct context *c)
static void * test_crypto_thread(void *arg)
void pre_setup(const struct options *options)
static void do_link_socket_new(struct context *c)
static void do_close_free_key_schedule(struct context *c, bool free_ssl_ctx)
static bool management_callback_proxy_cmd(void *arg, const char **p)
static void del_wfp_block(struct context *c, unsigned long adapter_index)
Remove any WFP block filters previously added.
void reset_coarse_timers(struct context *c)
static void do_open_ifconfig_pool_persist(struct context *c)
static void do_close_ifconfig_pool_persist(struct context *c)
static void do_close_tun(struct context *c, bool force)
void init_management(void)
void init_instance_handle_signals(struct context *c, const struct env_set *env, const unsigned int flags)
static void do_init_crypto_tls(struct context *c, const unsigned int flags)
void write_pid_file(const char *filename, const char *chroot_dir)
void context_gc_free(struct context *c)
static void socket_restart_pause(struct context *c)
static void do_open_status_output(struct context *c)
void init_options_dev(struct options *options)
static void do_close_free_buf(struct context *c)
void init_query_passwords(const struct context *c)
Query for private key and auth-user-pass username/passwords.
void inherit_context_child(struct context *dest, const struct context *src, struct link_socket *sock)
static void do_compute_occ_strings(struct context *c)
void context_clear_2(struct context *c)
static void do_close_fragment(struct context *c)
void context_clear(struct context *c)
static void update_options_ce_post(struct options *options)
static void do_init_crypto_none(struct context *c)
static void management_callback_status_p2p(void *arg, const int version, struct status_output *so)
void remove_pid_file(void)
static void add_delim_if_non_empty(struct buffer *buf, const char *header)
Helper function for tls_print_deferred_options_results Adds the ", " delimitor if there already some ...
bool print_openssl_info(const struct options *options)
void close_context(struct context *c, int sig, unsigned int flags)
static bool ce_management_query_remote(struct context *c)
static void open_tun_backend(struct context *c)
static void do_close_event_set(struct context *c)
bool do_persist_tuntap(struct options *options, openvpn_net_ctx_t *ctx)
static bool do_hold(int holdtime)
bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found)
static void do_init_server_poll_timeout(struct context *c)
static void do_close_plugins(struct context *c)
static void do_init_socket_phase1(struct context *c)
static void do_init_crypto_tls_c1(struct context *c)
static void frame_finalize_options(struct context *c, const struct options *o)
static void uninit_proxy_dowork(struct context *c)
static bool options_hash_changed_or_zero(const struct sha256_digest *a, const struct sha256_digest *b)
Helper for do_up().
static void add_wfp_block(struct context *c)
Add WFP filters to block traffic to local networks.
static void do_close_tun_simple(struct context *c)
static void do_inherit_plugins(struct context *c, const struct context *src)
static void run_up_down(const char *command, const struct plugin_list *plugins, int plugin_type, const char *arg, DWORD adapter_index, const char *dev_type, int tun_mtu, const char *ifconfig_local, const char *ifconfig_remote, const char *context, const char *signal_text, const char *script_type, struct env_set *es)
static void do_init_socket_phase2(struct context *c)
bool possibly_become_daemon(const struct options *options)
static bool management_callback_remote_entry_get(void *arg, unsigned int index, char **remote)
static void init_connection_list(struct context *c)
static void init_proxy_dowork(struct context *c)
static void do_close_packet_id(struct context *c)
static void do_startup_pause(struct context *c)
static size_t get_frame_mtu(struct context *c, const struct options *o)
static bool do_deferred_p2p_ncp(struct context *c)
#define CF_INIT_TLS_AUTH_STANDALONE
unsigned int pull_permission_mask(const struct context *c)
static bool do_deferred_options_part2(struct context *c)
This function is expected to be invoked after open_tun() was performed.
static void do_env_set_destroy(struct context *c)
static void do_init_buffers(struct context *c)
static void init_proxy(struct context *c)
void init_management_callback_p2p(struct context *c)
void management_show_net_callback(void *arg, const int msglevel)
static bool management_callback_send_cc_message(void *arg, const char *command, const char *parameters)
This method sends a custom control channel message.
bool do_route(const struct options *options, struct route_list *route_list, struct route_ipv6_list *route_ipv6_list, const struct tuntap *tt, const struct plugin_list *plugins, struct env_set *es, openvpn_net_ctx_t *ctx)
static void do_inherit_env(struct context *c, const struct env_set *src)
void context_clear_all_except_first_time(struct context *c)
struct context_buffers * init_context_buffers(const struct frame *frame)
bool do_deferred_options(struct context *c, const unsigned int found)
static bool do_open_tun(struct context *c, int *error_flags)
static void do_close_tls(struct context *c)
void close_management(void)
#define CC_HARD_USR1_TO_HUP
static int min_int(int x, int y)
static int max_int(int x, int y)
static SERVICE_STATUS status
void interval_init(struct interval *top, int horizon, int refresh)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t last)
Initialises a timer struct.
static void event_timeout_clear(struct event_timeout *et)
Clears the timeout and reset all values to 0.
int set_lladdr(openvpn_net_ctx_t *ctx, const char *ifname, const char *lladdr, const struct env_set *es)
void management_pre_tunnel_close(struct management *man)
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
void management_clear_callback(struct management *man)
bool management_hold(struct management *man, int holdtime)
struct management * management_init(void)
void management_event_loop_n_seconds(struct management *man, int sec)
void management_close(struct management *man)
void management_set_state(struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local, const struct openvpn_sockaddr *remote)
bool management_open(struct management *man, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
void management_notify_generic(struct management *man, const char *str)
void man_persist_client_stats(struct management *man, struct context *c)
void management_set_callback(struct management *man, const struct management_callback *cb)
void management_up_down(struct management *man, const char *updown, const struct env_set *es)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
void management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip)
static bool management_query_remote_enabled(const struct management *man)
#define OPENVPN_STATE_CONNECTING
static bool management_query_proxy_enabled(const struct management *man)
#define OPENVPN_STATE_CONNECTED
void set_std_files_to_null(bool stdin_only)
#define GET_USER_PASS_MANAGEMENT
#define GET_USER_PASS_NEED_OK
static bool get_user_pass(struct user_pass *up, const char *auth_file, const char *prefix, const unsigned int flags)
Retrieves the user credentials from various sources depending on the flags.
void frame_calculate_dynamic(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
Set the –mssfix option.
void frame_print(const struct frame *frame, int level, const char *prefix)
size_t frame_calculate_protocol_header_size(const struct key_type *kt, const struct options *options, bool occ)
Calculates the size of the OpenVPN protocol header.
static const char * np(const char *str)
#define OCC_MTU_LOAD_INTERVAL_SECONDS
static int occ_reset_op(void)
#define OCC_INTERVAL_SECONDS
bool set_mute_cutoff(const int cutoff)
void set_check_status(unsigned int info_level, unsigned int verbose_level)
void reset_check_status(void)
bool set_debug_level(const int level, const unsigned int flags)
static bool check_debug_level(unsigned int level)
static void set_check_status_error_delay(unsigned int milliseconds)
static void packet_id_persist_init(struct packet_id_persist *p)
void options_detach(struct options *o)
void pre_connect_restore(struct options *o, struct gc_arena *gc)
void options_string_import(struct options *options, const char *config, const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
const char * options_string_version(const char *s, struct gc_arena *gc)
const char title_string[]
void notnull(const char *arg, const char *description)
char * options_string(const struct options *o, const struct frame *frame, struct tuntap *tt, openvpn_net_ctx_t *ctx, bool remote, struct gc_arena *gc)
#define MODE_POINT_TO_POINT
#define CE_MAN_QUERY_REMOTE_QUERY
#define OPT_P_NCP
Negotiable crypto parameters.
#define OPT_P_EXPLICIT_NOTIFY
#define CE_MAN_QUERY_REMOTE_SKIP
static bool dco_enabled(const struct options *o)
Returns whether the current configuration has dco enabled.
#define SHAPER_DEFINED(opt)
#define CE_MAN_QUERY_REMOTE_MOD
#define CE_MAN_QUERY_PROXY
#define CE_MAN_QUERY_REMOTE_MASK
#define CE_MAN_QUERY_REMOTE_SHIFT
@ GENKEY_TLS_CRYPTV2_SERVER
@ GENKEY_TLS_CRYPTV2_CLIENT
#define CE_MAN_QUERY_REMOTE_ACCEPT
#define PULL_DEFINED(opt)
#define ROUTE_OPTION_FLAGS(o)
#define OPT_P_ROUTE_EXTRAS
static void update_time(void)
void packet_id_persist_save(struct packet_id_persist *p)
void packet_id_persist_load_obj(const struct packet_id_persist *p, struct packet_id *pid)
void packet_id_init(struct packet_id *p, int seq_backtrack, int time_backtrack, const char *name, int unit)
void packet_id_persist_close(struct packet_id_persist *p)
void packet_id_free(struct packet_id *p)
void packet_id_persist_load(struct packet_id_persist *p, const char *filename)
#define PRE_PULL_INITIAL_PING_RESTART
void plugin_list_close(struct plugin_list *pl)
void plugin_return_free(struct plugin_return *pr)
struct plugin_list * plugin_list_inherit(const struct plugin_list *src)
struct plugin_list * plugin_list_init(const struct plugin_option_list *list)
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)
void plugin_list_open(struct plugin_list *pl, const struct plugin_option_list *list, struct plugin_return *pr, const struct env_set *es, const int init_point)
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)
struct ifconfig_pool_persist * ifconfig_pool_persist_init(const char *filename, int refresh_freq)
void ifconfig_pool_persist_close(struct ifconfig_pool_persist *persist)
void http_proxy_close(struct http_proxy_info *hp)
struct http_proxy_info * http_proxy_new(const struct http_proxy_options *o)
struct http_proxy_options * init_http_proxy_options_once(struct http_proxy_options **hpo, struct gc_arena *gc)
bool add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
void setenv_routes_ipv6(struct env_set *es, const struct route_ipv6_list *rl6)
void add_route_ipv6_to_option_list(struct route_ipv6_option_list *l, const char *prefix, const char *gateway, const char *metric)
bool block_local_needed(const struct route_list *rl)
Get the decision whether to block traffic to local networks while the VPN is connected.
void show_routes(int msglev)
bool init_route_ipv6_list(struct route_ipv6_list *rl6, const struct route_ipv6_option_list *opt6, const char *remote_endpoint, int default_metric, const struct in6_addr *remote_host_ipv6, struct env_set *es, openvpn_net_ctx_t *ctx)
bool init_route_list(struct route_list *rl, const struct route_option_list *opt, const char *remote_endpoint, int default_metric, in_addr_t remote_host, struct env_set *es, openvpn_net_ctx_t *ctx)
void delete_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tuntap *tt, unsigned int flags, const struct env_set *es, openvpn_net_ctx_t *ctx)
void setenv_routes(struct env_set *es, const struct route_list *rl)
static int route_did_redirect_default_gateway(const struct route_list *rl)
int script_security(void)
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 shaper_msg(struct shaper *s)
static void shaper_init(struct shaper *s, int bytes_per_second)
void post_init_signal_catch(void)
void print_status(struct context *c, struct status_output *so)
void pre_init_signal_catch(void)
void remap_signal(struct context *c)
const char * signal_description(const int signum, const char *sigtext)
void restore_signal_state(void)
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 link_socket_init_phase1(struct context *c, int sock_index, int mode)
void link_socket_init_phase2(struct context *c, struct link_socket *sock)
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
void link_socket_update_buffer_sizes(struct link_socket *sock, int rcvbuf, int sndbuf)
const struct in6_addr * link_socket_current_remote_ipv6(const struct link_socket_info *info)
void link_socket_close(struct link_socket *sock)
in_addr_t link_socket_current_remote(const struct link_socket_info *info)
void do_preresolve(struct context *c)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
struct link_socket * link_socket_new(void)
bool link_socket_update_flags(struct link_socket *sock, unsigned int sockflags)
#define IA_EMPTY_IF_UNDEF
#define LS_MODE_TCP_ACCEPT_FROM
static bool proto_is_udp(int proto)
Returns if the protocol being used is UDP.
static bool proto_is_tcp(int proto)
returns if the proto is a TCP variant (tcp-server, tcp-client or tcp)
static bool proto_is_dgram(int proto)
Return if the protocol is datagram (UDP)
static bool addr_defined(const struct openvpn_sockaddr *addr)
#define LS_MODE_TCP_LISTEN
struct socks_proxy_info * socks_proxy_new(const char *server, const char *port, const char *authfile)
void socks_proxy_close(struct socks_proxy_info *sp)
void ssl_purge_auth(const bool auth_user_pass_only)
void init_ssl(const struct options *options, struct tls_root_ctx *new_ctx, bool in_chroot)
Build master SSL context object that serves for the whole of OpenVPN instantiation.
void pem_password_setup(const char *auth_file)
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...
void auth_user_pass_setup(const char *auth_file, bool is_inline, const struct static_challenge_info *sci)
void enable_auth_user_pass(void)
void show_available_tls_ciphers(const char *cipher_list, const char *cipher_list_tls13, const char *tls_cert_profile)
#define X509_USERNAME_FIELD_DEFAULT
#define TLS_MULTI_HORIZON
#define TLS_MULTI_REFRESH
void tls_ctx_free(struct tls_root_ctx *ctx)
Frees the library-specific TLSv1 context.
void show_available_curves(void)
Show the available elliptic curves in the crypto library.
bool tls_ctx_initialised(struct tls_root_ctx *ctx)
Checks whether the given TLS context is initialised.
@ CAS_RECONNECT_PENDING
session has already successful established (CAS_CONNECT_DONE) but has a reconnect and needs to redo s...
bool check_pull_client_ncp(struct context *c, const int found)
Checks whether the cipher negotiation is in an acceptable state and we continue to connect or should ...
bool tls_item_in_cipher_list(const char *item, const char *list)
Return true iff item is present in the colon-separated zero-terminated cipher list.
const char * get_p2p_ncp_cipher(struct tls_session *session, const char *peer_info, struct gc_arena *gc)
Determines the best common cipher from both peers IV_CIPHER lists.
Control Channel SSL/Data dynamic negotiation Module This file is split from ssl.h to be able to unit ...
hmac_ctx_t * session_id_hmac_init(void)
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.
#define NS_CERT_CHECK_SERVER
Do not perform Netscape certificate type verification.
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)
bool status_close(struct status_output *so)
#define STATUS_OUTPUT_WRITE
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
struct local_list * local_list
int connect_retry_seconds
bool tls_crypt_v2_force_cookie
int connect_retry_seconds_max
const char * tls_crypt_file
const char * tls_crypt_v2_file
bool tun_mtu_extra_defined
const char * socks_proxy_port
struct http_proxy_options * http_proxy_options
bool tls_crypt_file_inline
bool tls_auth_file_inline
int explicit_exit_notification
const char * socks_proxy_authfile
const char * socks_proxy_server
const char * tls_auth_file
bool tls_crypt_v2_file_inline
struct connection_entry ** array
Level 0 context containing information related to the OpenVPN process.
struct platform_state_group platform_state_group
struct platform_state_user platform_state_user
struct ifconfig_pool_persist * ifconfig_pool_persist
struct status_output * status_output
struct route_list * route_list
List of routing information.
struct link_socket_addr * link_socket_addrs
Local and remote addresses on the external network.
struct sha256_digest pulled_options_digest_save
Hash of option strings received from the remote OpenVPN server.
struct route_ipv6_list * route_ipv6_list
struct packet_id_persist pid_persist
struct http_proxy_info * http_proxy
bool tuntap_owned
Whether the tun/tap interface should be cleaned up when this context is cleaned up.
bool ifconfig_pool_persist_owned
struct socks_proxy_info * socks_proxy
struct tuntap * tuntap
Tun/tap virtual network interface.
char * options_string_local
struct fragment_master * fragment
char * options_string_remote
struct event_timeout route_wakeup_expire
md_ctx_t * pulled_options_state
struct man_def_auth_context mda_context
hmac_ctx_t * session_id_hmac
the HMAC we use to generate and verify our syn cookie like session ids from the server.
const struct link_socket * accept_from
struct tls_auth_standalone * tls_auth_standalone
TLS state structure required for the initial authentication of a client's connection attempt.
struct tls_multi * tls_multi
TLS state structure for this VPN tunnel.
struct frame frame_fragment
struct crypto_options crypto_options
Security parameters and crypto state used by the Data Channel Crypto module to process data channel p...
struct link_socket ** link_sockets
struct link_socket_info ** link_socket_infos
struct gc_arena gc
Garbage collection arena for allocations done in the level 2 scope of this context_2 structure.
struct sha256_digest pulled_options_digest
struct event_set * event_set
struct context_buffers * buffers
struct event_timeout route_wakeup
struct buffer read_link_buf
struct buffer encrypt_buf
struct buffer read_tun_buf
struct buffer decrypt_buf
int restart_sleep_seconds
Contains all state information for one tunnel.
int mode
Role of this context within the OpenVPN process.
struct context_0 * c0
Level 0 context.
bool did_we_daemonize
Whether demonization has already taken place.
bool first_time
True on the first iteration of OpenVPN's main loop.
struct signal_info * sig
Internal error signaling object.
openvpn_net_ctx_t net_ctx
Networking API opaque context.
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.
bool plugins_owned
Whether the plug-ins should be cleaned up when this context is cleaned up.
struct gc_arena gc
Garbage collection arena for allocations done in the scope of this context structure.
struct context_1 c1
Level 1 context.
struct context_persist persist
Persistent context.
unsigned int flags
Bit-flags determining behavior of security operation functions.
struct packet_id_persist * pid_persist
Persistent packet ID state for keeping state between successive OpenVPN process startups.
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
struct packet_id packet_id
Current packet ID state for both sending and receiving directions.
Packet geometry parameters.
int tun_mtu
the (user) configured tun-mtu.
int payload_size
the maximum size that a payload that our buffers can hold from either tun device or network link.
int tun_max_mtu
the maximum tun-mtu size the buffers are are sized for.
int extra_tun
Maximum number of bytes in excess of the tun/tap MTU that might be read from or written to the virtua...
int headroom
the headroom in the buffer, this is choosen to allow all potential header to be added before the pack...
int tailroom
the tailroom in the buffer.
Garbage collection arena used to keep track of dynamically allocated memory.
struct buffer tls_crypt_v2_wkc
Wrapped client key.
struct key2 original_wrap_keydata
original tls-crypt key preserved to xored into the tls_crypt renegotiation key
struct key_ctx auth_token_key
struct tls_root_ctx ssl_ctx
struct key_type tls_auth_key_type
struct key_ctx_bi tls_wrap_key
struct key_ctx_bi static_key
struct key_ctx tls_crypt_v2_server_key
const char * cipher
const name of the cipher
const char * digest
Message digest static parameters.
struct openvpn_sockaddr dest
struct link_socket_actual actual
struct addrinfo * remote_list
struct addrinfo * bind_local
struct addrinfo * current_remote
bool connection_established
struct link_socket_addr * lsa
struct link_socket_info info
const char * special_state_msg
void(* status)(void *arg, const int version, struct status_output *so)
bool(* remote_entry_get)(void *arg, unsigned int index, char **remote)
unsigned int(* remote_entry_count)(void *arg)
bool(* send_cc_message)(void *arg, const char *message, const char *parameter)
bool(* proxy_cmd)(void *arg, const char **p)
bool(* remote_cmd)(void *arg, const char **p)
void(* show_net)(void *arg, const int msglevel)
struct man_persist persist
union openvpn_sockaddr::@20 addr
const char * genkey_extra_data
struct compress_options comp
struct connection_list * connection_list
const char * management_port
const char * ifconfig_ipv6_remote
int renegotiate_seconds_min
const char * auth_token_secret_file
unsigned int imported_protocol_flags
const char * tls_export_peer_cert_dir
hash_algo_type verify_hash_algo
int management_state_buffer_size
int management_echo_buffer_size
unsigned remote_cert_ku[MAX_PARMS]
bool server_bridge_defined
const char * remote_cert_eku
bool server_bridge_proxy_dhcp
const char * exit_event_name
const char * ifconfig_ipv6_local
bool auth_user_pass_verify_script_via_file
int ifconfig_pool_persist_refresh_freq
struct remote_host_store * rh_store
const char * packet_id_file
const char * tls_crypt_v2_file
int management_log_history_cache
struct route_option_list * routes
const char * key_pass_file
bool mute_replay_warnings
unsigned int unsuccessful_attempts
const char * ifconfig_local
struct connection_entry ce
struct tuntap_options tuntap_options
struct verify_hash_list * verify_hash
const char * tls_cert_profile
int64_t renegotiate_packets
unsigned int management_flags
const char * route_default_gateway
bool exit_event_initial_state
struct static_challenge_info sc_info
bool auth_token_call_auth
const char * auth_user_pass_file
struct plugin_option_list * plugin_list
const char * tls_crypt_v2_verify_script
const char * auth_user_pass_verify_script
const char * route_ipv6_default_gateway
bool priv_key_file_inline
int ping_rec_timeout_action
bool auth_user_pass_file_inline
bool enable_ncp_fallback
If defined fall back to ciphername if NCP fails.
const char * route_predown_script
bool auth_token_secret_file_inline
const char * cipher_list_tls13
int status_file_update_freq
const char * management_client_user
const char * genkey_filename
const struct x509_track * x509_track
bool shared_secret_file_inline
const char * management_addr
const char * verify_x509_name
const char * client_crresponse_script
struct route_ipv6_option_list * routes_ipv6
bool tls_crypt_v2_file_inline
const char * ifconfig_remote_netmask
enum tun_driver_type windows_driver
int64_t renegotiate_bytes
const char * route_script
const char * management_user_pass
const char * shared_secret_file
const char * management_client_group
const char * client_config_dir
enum genkey_type genkey_type
const char * ifconfig_pool_persist_filename
int ifconfig_ipv6_netbits
struct openvpn_plugin_string_list * list[MAX_PLUGINS]
Wrapper struct to pass around SHA256 digests.
volatile int signal_received
struct tls_wrap_ctx tls_wrap
enum multi_status multi_state
struct tls_session session[TM_SIZE]
Array of tls_session objects representing control channel sessions with the remote peer.
int64_t renegotiate_bytes
struct key_ctx auth_token_key
unsigned int auth_token_renewal
unsigned int auth_token_lifetime
struct tls_wrap_ctx tls_wrap
TLS handshake wrapping state.
unsigned int crypto_flags
unsigned remote_cert_ku[MAX_PARMS]
interval_t packet_timeout
const char * auth_user_pass_file
const char * client_crresponse_script
const struct static_challenge_info * sci
openvpn_net_ctx_t * net_ctx
interval_t renegotiate_seconds
int64_t renegotiate_packets
bool auth_user_pass_file_inline
const struct plugin_list * plugins
const char * client_config_dir_exclusive
const char * export_peer_cert_dir
const char * verify_command
struct verify_hash_list * verify_hash
char * x509_username_field[2]
const char * config_ciphername
bool data_epoch_supported
whether our underlying data channel supports new data channel features (epoch keys with AEAD tag at t...
const char * verify_x509_name
const struct x509_track * x509_track
struct man_def_auth_context * mda_context
const char * tls_crypt_v2_verify_script
struct tls_root_ctx ssl_ctx
bool auth_user_pass_verify_script_via_file
const char * config_ncp_ciphers
bool auth_token_generate
Generate auth-tokens on successful user/pass auth,seet via options->auth_token_generate.
int push_peer_info_detail
The detail of info we push in peer info.
hash_algo_type verify_hash_algo
bool auth_token_call_auth
always call normal authentication
bool dco_enabled
Whether keys have to be installed in DCO or not.
const char * auth_user_pass_verify_script
const char * remote_cert_eku
Security parameter state of a single session within a VPN tunnel.
struct crypto_options opt
Crypto state.
struct buffer work
Work buffer (only for –tls-crypt)
struct key_ctx tls_crypt_v2_server_key
Decrypts client keys.
const struct buffer * tls_crypt_v2_wkc
Wrapped client key, sent to server.
enum tls_wrap_ctx::@23 mode
Control channel wrapping mode.
struct key2 original_wrap_keydata
original key data to be xored in to the key for dynamic tls-crypt.
enum tun_driver_type backend_driver
The backend driver that used for this tun/tap device.
struct tuntap_options options
struct in6_addr local_ipv6
char password[USER_PASS_LEN]
char username[USER_PASS_LEN]
void open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx)
int dev_type_enum(const char *dev, const char *dev_type)
void fork_register_dns_action(struct tuntap *tt)
struct tuntap * init_tun(const char *dev, const char *dev_type, int topology, const char *ifconfig_local_parm, const char *ifconfig_remote_netmask_parm, const char *ifconfig_ipv6_local_parm, int ifconfig_ipv6_netbits_parm, const char *ifconfig_ipv6_remote_parm, struct addrinfo *local_public, struct addrinfo *remote_public, const bool strict_warn, struct env_set *es, openvpn_net_ctx_t *ctx, struct tuntap *tt)
void show_adapters(int msglev)
bool is_dev_type(const char *dev, const char *dev_type, const char *match_type)
void do_ifconfig(struct tuntap *tt, const char *ifname, int tun_mtu, const struct env_set *es, openvpn_net_ctx_t *ctx)
do_ifconfig - configure the tunnel interface
const char * dev_type_string(const char *dev, const char *dev_type)
void close_tun(struct tuntap *tt, openvpn_net_ctx_t *ctx)
void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx)
void init_tun_post(struct tuntap *tt, const struct frame *frame, const struct tuntap_options *options)
const char * guess_tuntap_dev(const char *dev, const char *dev_type, const char *dev_node, struct gc_arena *gc)
void do_ifconfig_setenv(const struct tuntap *tt, struct env_set *es)
void undo_ifconfig(struct tuntap *tt, openvpn_net_ctx_t *ctx)
undo_ifconfig - undo configuration of the tunnel interface
void tun_standby_init(struct tuntap *tt)
const char * print_tun_backend_driver(enum tun_driver_type driver)
Return a string representation of the tun backed driver type.
#define IFCONFIG_AFTER_TUN_OPEN
#define IFCONFIG_BEFORE_TUN_OPEN
static bool tuntap_is_dco_win(struct tuntap *tt)
@ DRIVER_AFUNIX
using an AF_UNIX socket to pass packets from/to an external program.
static int ifconfig_order(struct tuntap *tt)
static void open_tun_null(struct tuntap *tt)
static int route_order(struct tuntap *tt)
static bool is_tun_type_set(const struct tuntap *tt)
void tuncfg(const char *dev, const char *dev_type, const char *dev_node, int persist_mode, const char *username, const char *groupname, const struct tuntap_options *options, openvpn_net_ctx_t *ctx)
void open_tun_afunix(struct options *o, int mtu, struct tuntap *tt, struct env_set *orig_env)
Opens an AF_UNIX based tun device.
void close_tun_afunix(struct tuntap *tt)
Closes the socket used for the AF_UNIX based device.
static bool is_tun_afunix(const char *devnode)
Checks whether a –dev-node parameter specifies a AF_UNIX device.
void win32_signal_open(struct win32_signal *ws, int force, const char *exit_event_name, bool exit_event_initial_state)
bool win_wfp_block(const NET_IFINDEX index, const HANDLE msg_channel, BOOL dns_only)
void window_title_generate(const char *title)
void window_title_save(struct window_title *wt)
bool win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel)
#define WSO_FORCE_SERVICE
#define WSO_FORCE_CONSOLE