Data Structures | Macros | Enumerations | Functions | Variables
options.h File Reference
#include "basic.h"
#include "common.h"
#include "mtu.h"
#include "route.h"
#include "tun.h"
#include "socket.h"
#include "plugin.h"
#include "manage.h"
#include "proxy.h"
#include "comp.h"
#include "pushlist.h"
#include "clinat.h"
#include "crypto_backend.h"
#include "dns.h"
Include dependency graph for options.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  options_pre_connect
struct  connection_entry
struct  remote_entry
struct  connection_list
struct  remote_list
struct  provider_list
struct  remote_host_store
struct  verify_hash_list
struct  options


#define MAX_PARMS   16
#define OPTION_PARM_SIZE   256
#define OPTION_LINE_SIZE   256
#define CE_DISABLED   (1<<0)
#define CE_MAN_QUERY_PROXY   (1<<1)
#define CE_MAN_QUERY_REMOTE_MASK   (0x07)
#define RH_HOST_LEN   80
#define RH_PORT_LEN   20
#define MODE_SERVER   1
#define PING_UNDEF   0
#define PING_EXIT   1
#define PING_RESTART   2
#define SF_NOPOOL   (1<<0)
#define SF_TCP_NODELAY_HELPER   (1<<1)
#define SF_NO_PUSH_ROUTE_GATEWAY   (1<<2)
#define streq(x, y)   (!strcmp((x), (y)))
#define OPT_P_GENERAL   (1<<0)
#define OPT_P_UP   (1<<1)
#define OPT_P_ROUTE   (1<<2)
#define OPT_P_DHCPDNS   (1<<3) /* includes ip windows options like */
#define OPT_P_SCRIPT   (1<<4)
#define OPT_P_SETENV   (1<<5)
#define OPT_P_SHAPER   (1<<6)
#define OPT_P_TIMER   (1<<7)
#define OPT_P_PERSIST   (1<<8)
#define OPT_P_PERSIST_IP   (1<<9)
#define OPT_P_COMP   (1<<10) /* TODO */
#define OPT_P_MESSAGES   (1<<11)
#define OPT_P_NCP   (1<<12)
 Negotiable crypto parameters. More...
#define OPT_P_TLS_PARMS   (1<<13) /* TODO */
#define OPT_P_MTU   (1<<14) /* TODO */
#define OPT_P_NICE   (1<<15)
#define OPT_P_PUSH   (1<<16)
#define OPT_P_INSTANCE   (1<<17)
 allowed in ccd, client-connect etc More...
#define OPT_P_CONFIG   (1<<18)
#define OPT_P_EXPLICIT_NOTIFY   (1<<19)
#define OPT_P_ECHO   (1<<20)
#define OPT_P_INHERIT   (1<<21)
#define OPT_P_ROUTE_EXTRAS   (1<<22)
#define OPT_P_PULL_MODE   (1<<23)
#define OPT_P_PLUGIN   (1<<24)
#define OPT_P_SOCKBUF   (1<<25)
#define OPT_P_SOCKFLAGS   (1<<26)
#define OPT_P_CONNECTION   (1<<27)
#define OPT_P_PEER_ID   (1<<28)
#define OPT_P_INLINE   (1<<29)
#define OPT_P_PUSH_MTU   (1<<30)
#define PULL_DEFINED(opt)   ((opt)->pull)
#define PUSH_DEFINED(opt)   ((opt)->push_list)
#define ROUTE_OPTION_FLAGS(o)   ((o)->route_method & ROUTE_METHOD_MASK)
#define SHAPER_DEFINED(opt)   ((opt)->shaper)
#define PLUGIN_OPTION_LIST(opt)   ((opt)->plugin_list)
#define MAN_CLIENT_AUTH_ENABLED(opt)   ((opt)->management_flags & MF_CLIENT_AUTH)
#define AR_NONE   0
#define AR_INTERACT   1
#define AR_NOINTERACT   2




void parse_argv (struct options *options, const int argc, char *argv[], const int msglevel, const unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void notnull (const char *arg, const char *description)
void usage_small (void)
void show_library_versions (const unsigned int flags)
void show_windows_version (const unsigned int flags)
void show_dco_version (const unsigned int flags)
void init_options (struct options *o, const bool init_gc)
void uninit_options (struct options *o)
void setenv_settings (struct env_set *es, const struct options *o)
void show_settings (const struct options *o)
bool string_defined_equal (const char *s1, const char *s2)
const char * options_string_version (const char *s, struct gc_arena *gc)
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)
bool options_cmp_equal_safe (char *actual, const char *expected, size_t actual_n)
void options_warning_safe (char *actual, const char *expected, size_t actual_n)
bool options_cmp_equal (char *actual, const char *expected)
void options_warning (char *actual, const char *expected)
char * options_string_extract_option (const char *options_string, const char *opt_name, struct gc_arena *gc)
 Given an OpenVPN options string, extract the value of an option. More...
void options_postprocess (struct options *options, struct env_set *es)
bool options_postprocess_pull (struct options *o, struct env_set *es)
void pre_connect_restore (struct options *o, struct gc_arena *gc)
bool apply_push_options (struct options *options, struct buffer *buf, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void options_detach (struct options *o)
void options_server_import (struct options *o, const char *filename, int msglevel, unsigned int permission_mask, unsigned int *option_types_found, struct env_set *es)
void pre_pull_default (struct options *o)
void rol_check_alloc (struct options *options)
int parse_line (const char *line, char *p[], const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
int parse_topology (const char *str, const int msglevel)
const char * print_topology (const int topology)
int auth_retry_get (void)
bool auth_retry_set (const int msglevel, const char *option)
const char * auth_retry_print (void)
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)
bool key_is_external (const struct options *options)
static bool dco_enabled (const struct options *o)
 Returns whether the current configuration has dco enabled. More...


const char title_string []

Macro Definition Documentation


#define AR_INTERACT   1

Definition at line 886 of file options.h.


#define AR_NOINTERACT   2

Definition at line 887 of file options.h.


#define AR_NONE   0

Definition at line 885 of file options.h.


#define CE_DISABLED   (1<<0)

Definition at line 143 of file options.h.


#define CE_MAN_QUERY_PROXY   (1<<1)

Definition at line 144 of file options.h.



Definition at line 147 of file options.h.


#define CE_MAN_QUERY_REMOTE_MASK   (0x07)

Definition at line 150 of file options.h.



Definition at line 148 of file options.h.



Definition at line 146 of file options.h.



Definition at line 151 of file options.h.



Definition at line 149 of file options.h.



Definition at line 145 of file options.h.



Definition at line 180 of file options.h.


#define MAN_CLIENT_AUTH_ENABLED (   opt)    ((opt)->management_flags & MF_CLIENT_AUTH)

Definition at line 773 of file options.h.


#define MAX_PARMS   16

Definition at line 52 of file options.h.



Definition at line 245 of file options.h.


#define MODE_SERVER   1

Definition at line 246 of file options.h.


#define OPT_P_COMP   (1<<10) /* TODO */

Definition at line 723 of file options.h.


#define OPT_P_CONFIG   (1<<18)

Definition at line 731 of file options.h.


#define OPT_P_CONNECTION   (1<<27)

Definition at line 740 of file options.h.



Definition at line 745 of file options.h.


#define OPT_P_DHCPDNS   (1<<3) /* includes ip windows options like */

Definition at line 716 of file options.h.


#define OPT_P_ECHO   (1<<20)

Definition at line 733 of file options.h.


#define OPT_P_EXPLICIT_NOTIFY   (1<<19)

Definition at line 732 of file options.h.


#define OPT_P_GENERAL   (1<<0)

Definition at line 713 of file options.h.


#define OPT_P_INHERIT   (1<<21)

Definition at line 734 of file options.h.


#define OPT_P_INLINE   (1<<29)

Definition at line 742 of file options.h.


#define OPT_P_INSTANCE   (1<<17)

allowed in ccd, client-connect etc

Definition at line 730 of file options.h.


#define OPT_P_MESSAGES   (1<<11)

Definition at line 724 of file options.h.


#define OPT_P_MTU   (1<<14) /* TODO */

Definition at line 727 of file options.h.


#define OPT_P_NCP   (1<<12)

Negotiable crypto parameters.

Definition at line 725 of file options.h.


#define OPT_P_NICE   (1<<15)

Definition at line 728 of file options.h.


#define OPT_P_PEER_ID   (1<<28)

Definition at line 741 of file options.h.


#define OPT_P_PERSIST   (1<<8)

Definition at line 721 of file options.h.


#define OPT_P_PERSIST_IP   (1<<9)

Definition at line 722 of file options.h.


#define OPT_P_PLUGIN   (1<<24)

Definition at line 737 of file options.h.


#define OPT_P_PULL_MODE   (1<<23)

Definition at line 736 of file options.h.


#define OPT_P_PUSH   (1<<16)

Definition at line 729 of file options.h.


#define OPT_P_PUSH_MTU   (1<<30)

Definition at line 743 of file options.h.


#define OPT_P_ROUTE   (1<<2)

Definition at line 715 of file options.h.


#define OPT_P_ROUTE_EXTRAS   (1<<22)

Definition at line 735 of file options.h.


#define OPT_P_SCRIPT   (1<<4)

Definition at line 717 of file options.h.


#define OPT_P_SETENV   (1<<5)

Definition at line 718 of file options.h.


#define OPT_P_SHAPER   (1<<6)

Definition at line 719 of file options.h.


#define OPT_P_SOCKBUF   (1<<25)

Definition at line 738 of file options.h.


#define OPT_P_SOCKFLAGS   (1<<26)

Definition at line 739 of file options.h.


#define OPT_P_TIMER   (1<<7)

Definition at line 720 of file options.h.


#define OPT_P_TLS_PARMS   (1<<13) /* TODO */

Definition at line 726 of file options.h.


#define OPT_P_UP   (1<<1)

Definition at line 714 of file options.h.


#define OPTION_LINE_SIZE   256

Definition at line 58 of file options.h.


#define OPTION_PARM_SIZE   256

Definition at line 57 of file options.h.


#define PING_EXIT   1

Definition at line 340 of file options.h.


#define PING_RESTART   2

Definition at line 341 of file options.h.


#define PING_UNDEF   0

Definition at line 339 of file options.h.


#define PLUGIN_OPTION_LIST (   opt)    ((opt)->plugin_list)

Definition at line 767 of file options.h.


#define PULL_DEFINED (   opt)    ((opt)->pull)

Definition at line 747 of file options.h.


#define PUSH_DEFINED (   opt)    ((opt)->push_list)

Definition at line 748 of file options.h.


#define RH_HOST_LEN   80

Definition at line 214 of file options.h.


#define RH_PORT_LEN   20

Definition at line 216 of file options.h.


#define ROUTE_OPTION_FLAGS (   o)    ((o)->route_method & ROUTE_METHOD_MASK)

Definition at line 759 of file options.h.


#define SF_NO_PUSH_ROUTE_GATEWAY   (1<<2)

Definition at line 461 of file options.h.


#define SF_NOPOOL   (1<<0)

Definition at line 459 of file options.h.


#define SF_TCP_NODELAY_HELPER   (1<<1)

Definition at line 460 of file options.h.


#define SHAPER_DEFINED (   opt)    ((opt)->shaper)

Definition at line 764 of file options.h.

◆ streq

#define streq (   x,
)    (!strcmp((x), (y)))

Definition at line 708 of file options.h.

Enumeration Type Documentation

◆ genkey_type


Definition at line 220 of file options.h.

◆ vlan_acceptable_frames


Definition at line 205 of file options.h.

Function Documentation

◆ apply_push_options()

bool apply_push_options ( struct options options,
struct buffer buf,
unsigned int  permission_mask,
unsigned int *  option_types_found,
struct env_set es 

◆ auth_retry_get()

int auth_retry_get ( void  )

◆ auth_retry_print()

const char* auth_retry_print ( void  )

Definition at line 4790 of file options.c.

References AR_INTERACT, AR_NOINTERACT, AR_NONE, and global_auth_retry.

Referenced by man_dispatch_command().

◆ auth_retry_set()

bool auth_retry_set ( const int  msglevel,
const char *  option 

Definition at line 4767 of file options.c.

References AR_INTERACT, AR_NOINTERACT, AR_NONE, global_auth_retry, msg, and streq.

Referenced by add_option(), and man_dispatch_command().

◆ dco_enabled()

static bool dco_enabled ( const struct options o)

◆ init_options()

void init_options ( struct options o,
const bool  init_gc 

Definition at line 790 of file options.c.

References connection_entry::af, options::allow_recursive_routing, options::auth_token_generate, options::authname, connection_entry::bind_ipv6_only, connection_entry::bind_local, options::block_outside_dns, options::ce, options::cf_initial_max, options::cf_initial_per, CLEAR, options::connect_retry_max, connection_entry::connect_retry_seconds, connection_entry::connect_retry_seconds_max, connection_entry::connect_timeout, DEFAULT_SEQ_BACKTRACK, DEFAULT_TIME_BACKTRACK, tuntap_options::dhcp_lease_time, tuntap_options::dhcp_masq_offset, tuntap_options::disable_dco, options::dns_options, options::ecdh_curve, dns_options::gc, options::gc, gc_init(), options::gc_owned, options::handshake_window, options::ifconfig_pool_persist_refresh_freq, tuntap_options::ip_win32_type, IPW32_SET_ADAPTIVE, IPW32_SET_DHCP_MASQ, options::key_direction, KEY_DIRECTION_BIDIRECTIONAL, connection_entry::link_mtu, LINK_MTU_DEFAULT, connection_entry::local_port, M_USAGE, options::management_echo_buffer_size, options::management_log_history_cache, options::management_state_buffer_size, options::max_clients, options::max_routes_per_client, options::mode, MODE_POINT_TO_POINT, msg, connection_entry::mssfix, connection_entry::mssfix_default, connection_entry::mssfix_encap, connection_entry::mtu_discover_type, options::n_bcast_buf, options::occ, connection_entry::occ_mtu, OPENVPN_PORT, options::persist_mode, connection_entry::proto, options::proto_force, PROTO_UDP, options::real_hash_size, connection_entry::remote_port, options::renegotiate_bytes, options::renegotiate_seconds, options::renegotiate_seconds_min, options::replay_time, options::replay_window, RESOLV_RETRY_INFINITE, options::resolve_in_advance, options::resolve_retry_seconds, options::route_delay_window, options::route_method, ROUTE_METHOD_ADAPTIVE, options::scheduled_exit_interval, options::stale_routes_check_interval, options::status_file_update_freq, options::status_file_version, options::tcp_queue_limit, options::tls_cert_profile, connection_entry::tls_mtu, TLS_MTU_DEFAULT, options::tls_timeout, options::tmp_dir, TOP_NET30, options::topology, options::transition_window, connection_entry::tun_mtu, TUN_MTU_DEFAULT, options::tuntap_options, options::verbosity, options::virtual_hash_size, options::vlan_accept, VLAN_ALL, options::vlan_pvid, win_get_tempdir(), options::windows_driver, WINDOWS_DRIVER_UNSPECIFIED, and X509_USERNAME_FIELD_DEFAULT.

Referenced by add_option(), openvpn_main(), options_postprocess_verify_ce(), and usage().

◆ key_is_external()

bool key_is_external ( const struct options options)

Definition at line 5710 of file options.c.

References options::cryptoapi_cert, options::management_flags, and MF_EXTERNAL_KEY.

Referenced by init_ssl().

◆ notnull()

void notnull ( const char *  arg,
const char *  description 

Definition at line 4908 of file options.c.

References M_USAGE, and msg.

Referenced by do_persist_tuntap(), options_postprocess_mutate(), and options_postprocess_verify_ce().

◆ options_cmp_equal()

bool options_cmp_equal ( char *  actual,
const char *  expected 

Definition at line 4465 of file options.c.

References options_cmp_equal_safe().

Referenced by key_method_2_read().

◆ options_cmp_equal_safe()

bool options_cmp_equal_safe ( char *  actual,
const char *  expected,
size_t  actual_n 

Definition at line 4607 of file options.c.

References D_SHOW_OCC, gc_free(), gc_new(), msg, and options_warning_safe_ml().

Referenced by options_cmp_equal(), and process_received_occ_msg().

◆ options_detach()

void options_detach ( struct options o)

◆ options_postprocess()

void options_postprocess ( struct options options,
struct env_set es 

◆ options_postprocess_pull()

bool options_postprocess_pull ( struct options o,
struct env_set es 

◆ options_server_import()

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 

Definition at line 5528 of file options.c.

References D_PUSH, es, msg, and read_config_file().

Referenced by multi_client_connect_post(), and multi_client_connect_source_ccd().

◆ options_string()

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 

◆ options_string_extract_option()

char* options_string_extract_option ( const char *  options_string,
const char *  opt_name,
struct gc_arena gc 

Given an OpenVPN options string, extract the value of an option.

options_stringZero-terminated, comma-separated options string
opt_nameThe name of the option to extract
gcThe gc to allocate the return value
gc-allocated value of option with name opt_name if option was found, or NULL otherwise.

Definition at line 4644 of file options.c.

References gc_malloc(), and options_string().

Referenced by key_method_2_read().

◆ options_string_import()

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 

Definition at line 5548 of file options.c.

References es, and read_config_string().

Referenced by multi_client_connect_mda(), multi_client_connect_post_plugin(), and open_plugins().

◆ options_string_version()

const char* options_string_version ( const char *  s,
struct gc_arena gc 

Definition at line 4636 of file options.c.

References alloc_buf_gc(), BPTR, BSTR, and strncpynt().

Referenced by do_compute_occ_strings().

◆ options_warning()

void options_warning ( char *  actual,
const char *  expected 

Definition at line 4471 of file options.c.

References options_warning_safe().

Referenced by key_method_2_read().

◆ options_warning_safe()

void options_warning_safe ( char *  actual,
const char *  expected,
size_t  actual_n 

Definition at line 4630 of file options.c.

References D_SHOW_OCC, and options_warning_safe_ml().

Referenced by options_warning(), and process_received_occ_msg().

◆ parse_argv()

void parse_argv ( struct options options,
const int  argc,
char *  argv[],
const int  msglevel,
const unsigned int  permission_mask,
unsigned int *  option_types_found,
struct env_set es 

Definition at line 5385 of file options.c.

References add_option(), CLEAR, es, MAX_PARMS, msg, and usage().

Referenced by openvpn_main().

◆ parse_line()

int parse_line ( const char *  line,
char *  p[],
const int  n,
const char *  file,
const int  line_num,
int  msglevel,
struct gc_arena gc 

◆ parse_topology()

int parse_topology ( const char *  str,
const int  msglevel 

Definition at line 4711 of file options.c.

References msg, streq, TOP_NET30, TOP_P2P, TOP_SUBNET, and TOP_UNDEF.

Referenced by add_option().

◆ pre_connect_restore()

void pre_connect_restore ( struct options o,
struct gc_arena gc 

◆ pre_pull_default()

void pre_pull_default ( struct options o)

◆ print_topology()

const char* print_topology ( const int  topology)

Definition at line 4733 of file options.c.


Referenced by print_opt_topology().

◆ rol_check_alloc()

void rol_check_alloc ( struct options options)

Definition at line 1683 of file options.c.

References options::gc, new_route_option_list(), and options::routes.

Referenced by add_option(), helper_add_route(), and pre_connect_restore().

◆ setenv_settings()

void setenv_settings ( struct env_set es,
const struct options o 

◆ show_dco_version()

void show_dco_version ( const unsigned int  flags)

Definition at line 4861 of file options.c.

References dco_version_string(), gc_free(), gc_new(), and msg.

Referenced by openvpn_main(), and usage_version().

◆ show_library_versions()

void show_library_versions ( const unsigned int  flags)

Definition at line 4871 of file options.c.

References get_ssl_library_version(), LZO_LIB_VER_STR, and msg.

Referenced by openvpn_main(), and usage_version().

◆ show_settings()

void show_settings ( const struct options o)

◆ show_windows_version()

void show_windows_version ( const unsigned int  flags)

Definition at line 4852 of file options.c.

References gc_free(), gc_new(), msg, and win32_version_string().

Referenced by openvpn_main(), and usage_version().

◆ string_defined_equal()

bool string_defined_equal ( const char *  s1,
const char *  s2 

Definition at line 4917 of file options.c.

Referenced by options_postprocess_verify_ce().

◆ uninit_options()

void uninit_options ( struct options o)

◆ usage_small()

void usage_small ( void  )

Definition at line 4844 of file options.c.

References M_NOPREFIX, M_WARN, msg, openvpn_exit(), and OPENVPN_EXIT_STATUS_USAGE.

Referenced by x_msg_va().

Variable Documentation

◆ title_string

const char title_string[]