OpenVPN
Functions
options_string.h File Reference
#include "buffer.h"
#include "options.h"
Include dependency graph for options_string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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.
 
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.
 

Function Documentation

◆ options_cmp_equal()

bool options_cmp_equal ( char *  actual,
const char *  expected 
)

Definition at line 368 of file options_string.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 
)

◆ 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 
)

Build an options string to represent data channel encryption options.

This string must match exactly between peers. The keysize is checked separately by read_key().

The following options must match on both peers:

Tunnel options:

–dev tun|tap [unit number need not match] –dev-type tun|tap –link-mtu –udp-mtu –tun-mtu –proto udp –proto tcp-client [matched with –proto tcp-server on the other end of the connection] –proto tcp-server [matched with –proto tcp-client on the other end of the connection] –tun-ipv6 –ifconfig x y [matched with –ifconfig y x on the other end of the connection]

–comp-lzo –compress alg –fragment

Crypto Options:

–cipher –auth –secret

SSL Options:

–tls-auth –tls-client [matched with –tls-server on the other end of the connection] –tls-server [matched with –tls-client on the other end of the connection]

Definition at line 42 of file options_string.c.

References alloc_buf(), ASSERT, options::authname, BSTR, buf_printf(), calc_options_string_link_mtu(), options::ce, key_type::cipher, cipher_defined(), cipher_kt_key_size(), cipher_kt_name(), options::ciphername, COMP_ALG_UNDEF, dev_type_string(), key_type::digest, gc, ifconfig_options_string(), init_key_type(), init_tun(), KEY_METHOD_2, keydirection2ascii(), buffer::len, md_kt_name(), MODE_POINT_TO_POINT, options::ncp_ciphers, OPTION_LINE_SIZE, proto_remote(), PULL_DEFINED, options::shared_secret_file, connection_entry::tls_auth_file, TLS_CLIENT, tls_item_in_cipher_list(), TLS_SERVER, and frame::tun_mtu.

Referenced by do_compute_occ_strings(), and options_string_extract_option().

◆ 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.

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

Definition at line 399 of file options_string.c.

References gc, gc_malloc(), buffer::len, and options_string().

Referenced by key_method_2_read().

◆ options_string_version()

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

Definition at line 386 of file options_string.c.

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

Referenced by do_compute_occ_strings().

◆ options_warning()

void options_warning ( char *  actual,
const char *  expected 
)

Definition at line 380 of file options_string.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 374 of file options_string.c.

References D_SHOW_OCC, and options_warning_safe_ml().

Referenced by options_warning(), and process_received_occ_msg().