46 bool tt_local =
false;
99 if (ios && strlen(ios))
119#ifdef ENABLE_FRAGMENT
126#define TLS_CLIENT (o->tls_client)
127#define TLS_SERVER (o->tls_server)
252 const bool report_inconsistent,
const char *p1,
253 const struct buffer *b2_src,
const char *b1_name,
269 struct buffer b2 = *b2_src;
283 if (!strcmp(p1_prefix, p2_prefix))
285 if (report_inconsistent)
287 msg(msglevel,
"WARNING: '%s' is used inconsistently, %s='%s', %s='%s'",
296 msg(msglevel,
"WARNING: '%s' is present in %s config but missing in %s config, %s='%s'",
306 const bool report_inconsistent,
const struct buffer *b1_src,
307 const struct buffer *b2_src,
const char *b1_name,
const char *b2_name)
310 struct buffer b = *b1_src;
331 actual[actual_n - 1] = 0;
352 actual[actual_n - 1] = 0;
353 if (strncmp(actual, expected, 2))
355 msg(
D_SHOW_OCC,
"NOTE: Options consistency check may be skewed by version differences");
360 ret = !strcmp(actual, expected);
393#if defined(__GNUC__) || defined(__clang__)
394#pragma GCC diagnostic push
395#pragma GCC diagnostic ignored "-Wsign-compare"
402 const size_t opt_name_len = strlen(opt_name);
404 const char *p = option_string;
407 if (0 == strncmp(p, opt_name, opt_name_len) && strlen(p) > (opt_name_len + 1)
408 && p[opt_name_len] ==
' ')
411 const char *start = &p[opt_name_len + 1];
412 const char *end = strchr(p,
',');
413 size_t val_len = end ? end - start : strlen(start);
415 memcpy(ret, start, val_len);
427#if defined(__GNUC__) || defined(__clang__)
428#pragma GCC diagnostic pop
bool buf_printf(struct buffer *buf, const char *format,...)
printf-style append to a buffer with overflow check.
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
Allocate memory and, optionally, zero it.
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Allocate a buffer of the given size under garbage collection.
struct buffer alloc_buf(size_t size)
Allocate a buffer of the given size.
bool buf_parse(struct buffer *buf, const int delim, char *line, const int size)
Extract the next token from a buffer, delimited by a given character.
char * string_alloc(const char *str, struct gc_arena *gc)
Duplicate a string, allocating memory under garbage collection.
struct buffer string_alloc_buf(const char *str, struct gc_arena *gc)
Allocate a buffer containing a copy of the given string.
Buffer management functions and garbage collection.
#define BSTR(buf)
Return the buffer content pointer cast to char *.
#define BPTR(buf)
Return a pointer to the start of the buffer content.
static void strncpynt(char *dest, const char *src, size_t maxlen)
Like strncpy() but always null-terminates the destination.
static void gc_free(struct gc_arena *a)
Free all allocations in a garbage collection arena.
static bool strprefix(const char *str, const char *prefix)
Return true iff str starts with prefix.
static struct gc_arena gc_new(void)
Allocate and return a new, empty garbage collection arena.
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.
const char * keydirection2ascii(int kd, bool remote, bool humanreadable)
Data Channel Cryptography Module.
static bool cipher_defined(const char *ciphername)
Checks if the cipher is defined and is not the null (none) 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.
unsigned int cipher_kt_key_size(const char *ciphername)
Returns the size of keys used by the cipher, in bytes.
const char * safe_print(const char *str, struct gc_arena *gc)
size_t calc_options_string_link_mtu(const struct options *o, const struct frame *frame)
Calculate the link-mtu to advertise to our peer.
#define MODE_POINT_TO_POINT
#define PULL_DEFINED(opt)
bool options_cmp_equal(char *actual, const char *expected)
static const char * options_warning_extract_parm1(const char *option_string, struct gc_arena *gc_ret)
Compare option strings for equality.
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)
static void options_warning_safe_scan1(const msglvl_t msglevel, const int delim, const bool report_inconsistent, const struct buffer *b1_src, const struct buffer *b2_src, const char *b1_name, const char *b2_name)
static void options_warning_safe_ml(const msglvl_t msglevel, char *actual, const char *expected, size_t actual_n)
char * options_string_extract_option(const char *option_string, const char *opt_name, struct gc_arena *gc)
Given an OpenVPN options string, extract the value of an option.
static void options_warning_safe_scan2(const msglvl_t msglevel, const int delim, const bool report_inconsistent, const char *p1, const struct buffer *b2_src, const char *b1_name, const char *b2_name)
void options_warning(char *actual, const char *expected)
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)
Build an options string to represent data channel encryption options.
const char * proto_remote(int proto, bool remote)
Control Channel SSL/Data channel negotiation module.
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.
Control Channel SSL/Data dynamic negotiation Module This file is split from ssl.h to be able to unit ...
Wrapper structure for dynamically allocated memory.
const char * tls_auth_file
Packet geometry parameters.
int tun_mtu
the (user) configured tun-mtu.
Garbage collection arena used to keep track of dynamically allocated memory.
const char * cipher
const name of the cipher
const char * digest
Message digest static parameters.
struct compress_options comp
const char * ifconfig_ipv6_remote
const char * ifconfig_ipv6_local
const char * ifconfig_local
struct connection_entry ce
const char * ifconfig_remote_netmask
const char * shared_secret_file
int ifconfig_ipv6_netbits
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)
const char * dev_type_string(const char *dev, const char *dev_type)
const char * ifconfig_options_string(const struct tuntap *tt, bool remote, bool disable, struct gc_arena *gc)