OpenVPN
Functions | Variables
push.c File Reference
#include "syshead.h"
#include "push.h"
#include "options.h"
#include "ssl.h"
#include "ssl_verify.h"
#include "ssl_ncp.h"
#include "manage.h"
#include "memdbg.h"
#include "ssl_util.h"
Include dependency graph for push.c:

Go to the source code of this file.

Functions

void receive_auth_failed (struct context *c, const struct buffer *buffer)
 
void server_pushed_signal (struct context *c, const struct buffer *buffer, const bool restart, const int adv)
 
void server_pushed_info (struct context *c, const struct buffer *buffer, const int adv)
 
void receive_cr_response (struct context *c, const struct buffer *buffer)
 
static void parse_auth_pending_keywords (const struct buffer *buffer, unsigned int *server_timeout)
 Parse the keyword for the AUTH_PENDING request. More...
 
void receive_auth_pending (struct context *c, const struct buffer *buffer)
 Parses an AUTH_PENDING message and if in pull mode extends the timeout. More...
 
static bool push_option_fmt (struct gc_arena *gc, struct push_list *push_list, int msglevel, const char *fmt,...)
 Add an option to the given push list by providing a format string. More...
 
void send_auth_failed (struct context *c, const char *client_reason)
 
bool send_auth_pending_messages (struct tls_multi *tls_multi, const char *extra, unsigned int timeout)
 Sends the auth pending control messages to a client. More...
 
void send_restart (struct context *c, const char *kill_msg)
 
void incoming_push_message (struct context *c, const struct buffer *buffer)
 
bool send_push_request (struct context *c)
 
void prepare_auth_token_push_reply (struct tls_multi *tls_multi, struct gc_arena *gc, struct push_list *push_list)
 Prepare push option for auth-token. More...
 
bool prepare_push_reply (struct context *c, struct gc_arena *gc, struct push_list *push_list)
 Prepare push options, based on local options. More...
 
static bool send_push_options (struct context *c, struct buffer *buf, struct push_list *push_list, int safe_cap, bool *push_sent, bool *multi_push)
 
void send_push_reply_auth_token (struct tls_multi *multi)
 Sends a push reply message only containin the auth-token to update the auth-token on the client. More...
 
bool send_push_reply (struct context *c, struct push_list *per_client_push_list)
 
static void push_option_ex (struct gc_arena *gc, struct push_list *push_list, const char *opt, bool enable, int msglevel)
 
void push_option (struct options *o, const char *opt, int msglevel)
 
void clone_push_list (struct options *o)
 
void push_options (struct options *o, char **p, int msglevel, struct gc_arena *gc)
 
void push_reset (struct options *o)
 
void push_remove_option (struct options *o, const char *p)
 
int process_incoming_push_request (struct context *c)
 
static void push_update_digest (md_ctx_t *ctx, struct buffer *buf, const struct options *opt)
 
static int process_incoming_push_reply (struct context *c, unsigned int permission_mask, unsigned int *option_types_found, struct buffer *buf)
 
int process_incoming_push_msg (struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask, unsigned int *option_types_found)
 
void remove_iroutes_from_push_route_list (struct options *o)
 

Variables

static char push_reply_cmd [] = "PUSH_REPLY"
 

Function Documentation

◆ clone_push_list()

void clone_push_list ( struct options o)

◆ incoming_push_message()

void incoming_push_message ( struct context c,
const struct buffer buffer 
)

◆ parse_auth_pending_keywords()

static void parse_auth_pending_keywords ( const struct buffer buffer,
unsigned int *  server_timeout 
)
static

Parse the keyword for the AUTH_PENDING request.

Parameters
bufferbuffer containing the keywords, the buffer's content will be modified by this function
server_timeouttimeout pushed by the server or unchanged if the server does not push a timeout

Definition at line 241 of file push.c.

References BLEN, BSTR, buf_advance(), buf_parse(), buf_read_u8(), D_PUSH, management_set_state(), msg, OPENVPN_STATE_AUTH_PENDING, and OPTION_LINE_SIZE.

Referenced by receive_auth_pending().

◆ prepare_auth_token_push_reply()

void prepare_auth_token_push_reply ( struct tls_multi tls_multi,
struct gc_arena gc,
struct push_list push_list 
)

Prepare push option for auth-token.

Parameters
tls_multitls multi context of VPN tunnel
gcgc arena for allocating push options
push_listpush list to where options are added
Returns
true on success, false on failure.

Definition at line 518 of file push.c.

References tls_multi::auth_token, tls_multi::auth_token_initial, M_USAGE, and push_option_fmt().

Referenced by prepare_push_reply(), and send_push_reply_auth_token().

◆ prepare_push_reply()

bool prepare_push_reply ( struct context c,
struct gc_arena gc,
struct push_list push_list 
)

◆ process_incoming_push_msg()

int process_incoming_push_msg ( struct context c,
const struct buffer buffer,
bool  honor_received_options,
unsigned int  permission_mask,
unsigned int *  option_types_found 
)

◆ process_incoming_push_reply()

static int process_incoming_push_reply ( struct context c,
unsigned int  permission_mask,
unsigned int *  option_types_found,
struct buffer buf 
)
static

◆ process_incoming_push_request()

int process_incoming_push_request ( struct context c)

◆ push_option()

void push_option ( struct options o,
const char *  opt,
int  msglevel 
)

◆ push_option_ex()

static void push_option_ex ( struct gc_arena gc,
struct push_list push_list,
const char *  opt,
bool  enable,
int  msglevel 
)
static

◆ push_option_fmt()

static bool push_option_fmt ( struct gc_arena gc,
struct push_list push_list,
int  msglevel,
const char *  fmt,
  ... 
)
static

Add an option to the given push list by providing a format string.

The string added to the push options is allocated in o->gc, so the caller does not have to preserve anything.

Parameters
gcGC arena where options are allocated
push_listPush list containing options
msglevelThe message level to use when printing errors
fmtFormat string for the option
...Format string arguments
Returns
true on success, false on failure.

Definition at line 796 of file push.c.

References push_option_ex(), string_alloc(), and vsnprintf.

Referenced by prepare_auth_token_push_reply(), prepare_push_reply(), and receive_auth_pending().

◆ push_options()

void push_options ( struct options o,
char **  p,
int  msglevel,
struct gc_arena gc 
)

Definition at line 788 of file push.c.

References make_extended_arg_array(), print_argv(), and push_option().

Referenced by add_option().

◆ push_remove_option()

void push_remove_option ( struct options o,
const char *  p 
)

◆ push_reset()

void push_reset ( struct options o)

Definition at line 814 of file push.c.

References CLEAR, and options::push_list.

Referenced by add_option(), and clone_push_list().

◆ push_update_digest()

static void push_update_digest ( md_ctx_t ctx,
struct buffer buf,
const struct options opt 
)
static

◆ receive_auth_failed()

void receive_auth_failed ( struct context c,
const struct buffer buffer 
)

◆ receive_auth_pending()

void receive_auth_pending ( struct context c,
const struct buffer buffer 
)

Parses an AUTH_PENDING message and if in pull mode extends the timeout.

Parameters
cThe context struct
bufferBuffer containing the control message with AUTH_PENDING

Definition at line 284 of file push.c.

References __attribute__(), context::c2, D_PUSH, key_state::established, get_primary_key(), options::handshake_window, max_uint(), min_uint(), msg, context::options, parse_auth_pending_keywords(), options::pull, push_option_fmt(), context_2::push_request_timeout, options::renegotiate_seconds, and context_2::tls_multi.

Referenced by check_incoming_control_channel().

◆ receive_cr_response()

void receive_cr_response ( struct context c,
const struct buffer buffer 
)

◆ remove_iroutes_from_push_route_list()

void remove_iroutes_from_push_route_list ( struct options o)

◆ send_auth_failed()

void send_auth_failed ( struct context c,
const char *  client_reason 
)

◆ send_auth_pending_messages()

bool send_auth_pending_messages ( struct tls_multi tls_multi,
const char *  extra,
unsigned int  timeout 
)

◆ send_push_options()

static bool send_push_options ( struct context c,
struct buffer buf,
struct push_list push_list,
int  safe_cap,
bool *  push_sent,
bool *  multi_push 
)
static

◆ send_push_reply()

bool send_push_reply ( struct context c,
struct push_list per_client_push_list 
)

◆ send_push_reply_auth_token()

void send_push_reply_auth_token ( struct tls_multi multi)

Sends a push reply message only containin the auth-token to update the auth-token on the client.

Parameters
multi- The tls_multi structure belonging to the instance to push to

Definition at line 653 of file push.c.

Referenced by verify_user_pass().

◆ send_push_request()

bool send_push_request ( struct context c)

◆ send_restart()

void send_restart ( struct context c,
const char *  kill_msg 
)

◆ server_pushed_info()

void server_pushed_info ( struct context c,
const struct buffer buffer,
const int  adv 
)

◆ server_pushed_signal()

void server_pushed_signal ( struct context c,
const struct buffer buffer,
const bool  restart,
const int  adv 
)

Variable Documentation

◆ push_reply_cmd

char push_reply_cmd[] = "PUSH_REPLY"
static