|
OpenVPN
|
#include "syshead.h"#include "buffer.h"#include "crypto.h"#include "error.h"#include "mtu.h"#include "options.h"#include "socket_util.h"#include "ssl.h"#include "ssl_ncp.h"#include "tun.h"#include <string.h>
Go to the source code of this file.
Macros | |
| #define | TLS_CLIENT (o->tls_client) |
| #define | TLS_SERVER (o->tls_server) |
Functions | |
| 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. | |
| static const char * | options_warning_extract_parm1 (const char *option_string, struct gc_arena *gc_ret) |
| Compare option strings for equality. | |
| 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) |
| 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) |
| bool | options_cmp_equal_safe (char *actual, const char *expected, size_t actual_n) |
| bool | options_cmp_equal (char *actual, const char *expected) |
| void | options_warning_safe (char *actual, const char *expected, size_t actual_n) |
| void | options_warning (char *actual, const char *expected) |
| const char * | options_string_version (const char *s, struct gc_arena *gc) |
| 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. | |
| #define TLS_CLIENT (o->tls_client) |
| #define TLS_SERVER (o->tls_server) |
| 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().
| bool options_cmp_equal_safe | ( | char * | actual, |
| const char * | expected, | ||
| size_t | actual_n | ||
| ) |
Definition at line 345 of file options_string.c.
References D_SHOW_OCC, gc, gc_free(), gc_new(), msg, and options_warning_safe_ml().
Referenced by options_cmp_equal(), and process_received_occ_msg().
| 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().
| 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_string | Zero-terminated, comma-separated options string |
| opt_name | The name of the option to extract |
| gc | The gc to allocate the return value |
Definition at line 399 of file options_string.c.
References gc, gc_malloc(), buffer::len, and options_string().
Referenced by key_method_2_read().
| 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().
| 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().
|
static |
Compare option strings for equality.
If the first two chars of the strings differ, it means that we are looking at different versions of the options string, therefore don't compare them and return true.
Definition at line 237 of file options_string.c.
References buf_parse(), gc, gc_free(), gc_malloc(), gc_new(), buffer::len, OPTION_PARM_SIZE, string_alloc(), and string_alloc_buf().
Referenced by options_warning_safe_scan2().
| 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().
|
static |
Definition at line 323 of file options_string.c.
References alloc_buf_gc(), buf_printf(), gc, gc_free(), gc_new(), buffer::len, OPTION_PARM_SIZE, and options_warning_safe_scan1().
Referenced by options_cmp_equal_safe(), and options_warning_safe().
|
static |
Definition at line 305 of file options_string.c.
References buf_parse(), gc, gc_free(), gc_malloc(), gc_new(), buffer::len, OPTION_PARM_SIZE, and options_warning_safe_scan2().
Referenced by options_warning_safe_ml().
|
static |
Definition at line 251 of file options_string.c.
References buf_parse(), gc, gc_free(), gc_malloc(), gc_new(), buffer::len, msg, OPTION_PARM_SIZE, options_warning_extract_parm1(), safe_print(), streq, and strprefix().
Referenced by options_warning_safe_scan1().