OpenVPN
Macros | Functions | Variables
manage.c File Reference
#include "syshead.h"
#include "error.h"
#include "fdmisc.h"
#include "options.h"
#include "sig.h"
#include "event.h"
#include "otime.h"
#include "integer.h"
#include "misc.h"
#include "ssl.h"
#include "common.h"
#include "manage.h"
#include "openvpn.h"
#include "dco.h"
#include "memdbg.h"
Include dependency graph for manage.c:

Go to the source code of this file.

Macros

#define MANAGEMENT_ECHO_PULL_INFO   0
 
#define MANAGEMENT_ECHO_FLAGS   0
 
#define AF_DID_PUSH   (1<<0)
 
#define AF_DID_RESET   (1<<1)
 
#define IER_RESET   0
 
#define IER_NEW   1
 
#define MN_AT_LEAST   (1<<0)
 
#define MWCC_PASSWORD_WAIT   (1<<0)
 
#define MWCC_HOLD_WAIT   (1<<1)
 
#define MWCC_OTHER_WAIT   (1<<2)
 

Functions

static void man_output_standalone (struct management *man, volatile int *signal_received)
 
static void man_reset_client_socket (struct management *man, const bool exiting)
 
static void man_help (void)
 
static const char * man_state_name (const int state)
 
static void man_welcome (struct management *man)
 
static bool man_password_needed (struct management *man)
 
static void man_check_password (struct management *man, const char *line)
 
static void man_update_io_state (struct management *man)
 
static void man_output_list_push_finalize (struct management *man)
 
static void man_output_list_push_str (struct management *man, const char *str)
 
static void man_output_list_push (struct management *man, const char *str)
 
static void man_prompt (struct management *man)
 
static void report_command_status (const bool status, const char *command)
 Small function to report the success or failure of a command to the management interface. More...
 
static void man_delete_unix_socket (struct management *man)
 
static void man_close_socket (struct management *man, const socket_descriptor_t sd)
 
static void virtual_output_callback_func (void *arg, const unsigned int flags, const char *str)
 
static int man_mod_signal (const struct management *man, const int signum)
 
static void man_signal (struct management *man, const char *name)
 
static void man_command_unsupported (const char *command_name)
 
static void man_status (struct management *man, const int version, struct status_output *so)
 
static void man_bytecount (struct management *man, const int update_seconds)
 
static void man_bytecount_output_client (struct management *man, counter_type dco_read_bytes, counter_type dco_write_bytes)
 
void man_bytecount_output_server (const counter_type *bytes_in_total, const counter_type *bytes_out_total, struct man_def_auth_context *mdac)
 
static void man_kill (struct management *man, const char *victim)
 
static void man_history (struct management *man, const char *parm, const char *type, struct log_history *log, bool *realtime, const unsigned int lep_flags)
 
static void man_log (struct management *man, const char *parm)
 
static void man_echo (struct management *man, const char *parm)
 
static void man_state (struct management *man, const char *parm)
 
static void man_up_finalize (struct management *man)
 
static void man_query_user_pass (struct management *man, const char *type, const char *string, const bool needed, const char *prompt, char *dest, int len)
 
static void man_query_username (struct management *man, const char *type, const char *string)
 
static void man_query_password (struct management *man, const char *type, const char *string)
 
static void man_query_need_ok (struct management *man, const char *type, const char *action)
 
static void man_query_need_str (struct management *man, const char *type, const char *action)
 
static void man_forget_passwords (struct management *man)
 
static void man_net (struct management *man)
 
static void man_send_cc_message (struct management *man, const char *message, const char *parameters)
 
static void man_remote_entry_count (struct management *man)
 
static void man_remote_entry_get (struct management *man, const char *p1, const char *p2)
 
static void man_hold (struct management *man, const char *cmd)
 
static void in_extra_reset (struct man_connection *mc, const int mode)
 
static void in_extra_dispatch (struct management *man)
 
static bool parse_cid (const char *str, unsigned long *cid)
 
static bool parse_uint (const char *str, const char *what, unsigned int *uint)
 
static void man_client_pending_auth (struct management *man, const char *cid_str, const char *kid_str, const char *extra, const char *timeout_str)
 Will send a notification to the client that succesful authentication will require an additional step (web based SSO/2-factor auth/etc) More...
 
static void man_client_auth (struct management *man, const char *cid_str, const char *kid_str, const bool extra)
 
static void man_client_deny (struct management *man, const char *cid_str, const char *kid_str, const char *reason, const char *client_reason)
 
static void man_client_kill (struct management *man, const char *cid_str, const char *kill_msg)
 
static void man_client_n_clients (struct management *man)
 
static void man_env_filter (struct management *man, const int level)
 
static void man_pk_sig (struct management *man, const char *cmd_name)
 
static void man_certificate (struct management *man)
 
static void man_load_stats (struct management *man)
 
static bool man_need (struct management *man, const char **p, const int n, unsigned int flags)
 Checks if the correct number of arguments to a management command are present and otherwise prints an error and returns false. More...
 
static void man_proxy (struct management *man, const char **p)
 
static void man_remote (struct management *man, const char **p)
 
static void set_client_version (struct management *man, const char *version)
 
static void man_dispatch_command (struct management *man, struct status_output *so, const char **p, const int nparms)
 
static void man_start_ne32 (struct management *man)
 
static void man_stop_ne32 (struct management *man)
 
static void man_connection_settings_reset (struct management *man)
 
static void man_new_connection_post (struct management *man, const char *description)
 
static void man_accept (struct management *man)
 
static void man_listen (struct management *man)
 
static void man_connect (struct management *man)
 
static void man_process_command (struct management *man, const char *line)
 
static bool man_io_error (struct management *man, const char *prefix)
 
static int man_read (struct management *man)
 
static int man_write (struct management *man)
 
static void man_connection_clear (struct man_connection *mc)
 
static void man_persist_init (struct management *man, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size)
 
static void man_persist_close (struct man_persist *mp)
 
static void man_settings_init (struct man_settings *ms, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
 
static void man_settings_close (struct man_settings *ms)
 
static void man_connection_init (struct management *man)
 
static void man_connection_close (struct management *man)
 
struct managementmanagement_init (void)
 
bool management_open (struct management *man, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
 
void management_close (struct management *man)
 
void management_set_callback (struct management *man, const struct management_callback *cb)
 
void management_clear_callback (struct management *man)
 
void management_set_state (struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local, const struct openvpn_sockaddr *remote)
 
static bool env_filter_match (const char *env_str, const int env_filter_level)
 
static void man_output_env (const struct env_set *es, const bool tail, const int env_filter_level, const char *prefix)
 
static void man_output_extra_env (struct management *man, const char *prefix)
 
void management_up_down (struct management *man, const char *updown, const struct env_set *es)
 
void management_notify (struct management *man, const char *severity, const char *type, const char *text)
 
void management_notify_generic (struct management *man, const char *str)
 
static void man_output_peer_info_env (struct management *man, const struct man_def_auth_context *mdac)
 
void management_notify_client_needing_auth (struct management *management, const unsigned int mda_key_id, struct man_def_auth_context *mdac, const struct env_set *es)
 
void management_notify_client_cr_response (unsigned mda_key_id, const struct man_def_auth_context *mdac, const struct env_set *es, const char *response)
 
void management_connection_established (struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
 
void management_notify_client_close (struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
 
void management_learn_addr (struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
 
void management_echo (struct management *man, const char *string, const bool pull)
 
void management_post_tunnel_open (struct management *man, const in_addr_t tun_local_ip)
 
void management_pre_tunnel_close (struct management *man)
 
void management_auth_failure (struct management *man, const char *type, const char *reason)
 
void management_auth_token (struct management *man, const char *token)
 
static bool man_persist_state (unsigned int *persistent, const int n)
 
void management_socket_set (struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
 
void management_io (struct management *man)
 
static bool man_standalone_ok (const struct management *man)
 
static bool man_check_for_signals (volatile int *signal_received)
 
static int man_block (struct management *man, volatile int *signal_received, const time_t expire)
 
static int man_standalone_event_loop (struct management *man, volatile int *signal_received, const time_t expire)
 
static void man_wait_for_client_connection (struct management *man, volatile int *signal_received, const time_t expire, unsigned int flags)
 
void management_event_loop_n_seconds (struct management *man, int sec)
 
bool management_query_user_pass (struct management *man, struct user_pass *up, const char *type, const unsigned int flags, const char *static_challenge)
 
static int management_query_multiline (struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
 
static char * management_query_multiline_flatten_newline (struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
 
static char * management_query_multiline_flatten (struct management *man, const char *b64_data, const char *prompt, const char *cmd, int *state, struct buffer_list **input)
 
char * management_query_pk_sig (struct management *man, const char *b64_data, const char *algorithm)
 
char * management_query_cert (struct management *man, const char *cert_name)
 
bool management_would_hold (struct management *man)
 
bool management_should_daemonize (struct management *man)
 
bool management_hold (struct management *man, int holdtime)
 
struct command_linecommand_line_new (const int buf_len)
 
void command_line_reset (struct command_line *cl)
 
void command_line_free (struct command_line *cl)
 
void command_line_add (struct command_line *cl, const unsigned char *buf, const int len)
 
const char * command_line_get (struct command_line *cl)
 
void command_line_next (struct command_line *cl)
 
const char * log_entry_print (const struct log_entry *e, unsigned int flags, struct gc_arena *gc)
 
static void log_entry_free_contents (struct log_entry *e)
 
static int log_index (const struct log_history *h, int i)
 
static void log_history_obj_init (struct log_history *h, int capacity)
 
struct log_historylog_history_init (const int capacity)
 
static void log_history_free_contents (struct log_history *h)
 
void log_history_close (struct log_history *h)
 
void log_history_add (struct log_history *h, const struct log_entry *le)
 
void log_history_resize (struct log_history *h, const int capacity)
 
const struct log_entrylog_history_ref (const struct log_history *h, const int index)
 
void management_sleep (const int n)
 A sleep function that services the management layer for n seconds rather than doing nothing. More...
 
void management_check_bytecount (struct context *c, struct management *man, struct timeval *timeval)
 
void man_persist_client_stats (struct management *man, struct context *c)
 

Variables

static const char blank_up [] = "[[BLANK]]"
 
struct managementmanagement
 

Macro Definition Documentation

◆ AF_DID_PUSH

#define AF_DID_PUSH   (1<<0)

◆ AF_DID_RESET

#define AF_DID_RESET   (1<<1)

◆ IER_NEW

#define IER_NEW   1

Definition at line 953 of file manage.c.

◆ IER_RESET

#define IER_RESET   0

Definition at line 952 of file manage.c.

◆ MANAGEMENT_ECHO_FLAGS

#define MANAGEMENT_ECHO_FLAGS   0

Definition at line 57 of file manage.c.

◆ MANAGEMENT_ECHO_PULL_INFO

#define MANAGEMENT_ECHO_PULL_INFO   0

Definition at line 52 of file manage.c.

◆ MN_AT_LEAST

#define MN_AT_LEAST   (1<<0)

Definition at line 1238 of file manage.c.

◆ MWCC_HOLD_WAIT

#define MWCC_HOLD_WAIT   (1<<1)

Definition at line 3388 of file manage.c.

◆ MWCC_OTHER_WAIT

#define MWCC_OTHER_WAIT   (1<<2)

Definition at line 3389 of file manage.c.

◆ MWCC_PASSWORD_WAIT

#define MWCC_PASSWORD_WAIT   (1<<0)

Definition at line 3387 of file manage.c.

Function Documentation

◆ command_line_add()

void command_line_add ( struct command_line cl,
const unsigned char *  buf,
const int  len 
)

Definition at line 3895 of file manage.c.

References command_line::buf, buf_clear(), buf_write_u8(), CC_NEWLINE, CC_PRINT, and char_class().

Referenced by man_read().

◆ command_line_free()

void command_line_free ( struct command_line cl)

Definition at line 3882 of file manage.c.

References command_line::buf, command_line_reset(), free_buf(), and command_line::residual.

Referenced by man_connection_close().

◆ command_line_get()

const char* command_line_get ( struct command_line cl)

◆ command_line_new()

struct command_line* command_line_new ( const int  buf_len)

Definition at line 3865 of file manage.c.

References alloc_buf(), ALLOC_OBJ_CLEAR, command_line::buf, buf_len(), and command_line::residual.

Referenced by man_connection_init().

◆ command_line_next()

void command_line_next ( struct command_line cl)

Definition at line 3927 of file manage.c.

References command_line::buf, buf_clear(), buf_copy(), and command_line::residual.

Referenced by man_read().

◆ command_line_reset()

void command_line_reset ( struct command_line cl)

Definition at line 3875 of file manage.c.

References command_line::buf, buf_clear(), and command_line::residual.

Referenced by command_line_free(), and man_reset_client_socket().

◆ env_filter_match()

static bool env_filter_match ( const char *  env_str,
const int  env_filter_level 
)
static

Definition at line 2796 of file manage.c.

References SIZE.

Referenced by man_output_env().

◆ in_extra_dispatch()

static void in_extra_dispatch ( struct management man)
static

◆ in_extra_reset()

static void in_extra_reset ( struct man_connection mc,
const int  mode 
)
static

◆ log_entry_free_contents()

static void log_entry_free_contents ( struct log_entry e)
static

Definition at line 4005 of file manage.c.

References CLEAR, and log_entry::string.

Referenced by log_history_add(), and log_history_free_contents().

◆ log_entry_print()

const char* log_entry_print ( const struct log_entry e,
unsigned int  flags,
struct gc_arena gc 
)

◆ log_history_add()

void log_history_add ( struct log_history h,
const struct log_entry le 
)

◆ log_history_close()

void log_history_close ( struct log_history h)

Definition at line 4052 of file manage.c.

References log_history_free_contents().

Referenced by man_persist_close().

◆ log_history_free_contents()

static void log_history_free_contents ( struct log_history h)
static

◆ log_history_init()

struct log_history* log_history_init ( const int  capacity)

Definition at line 4031 of file manage.c.

References ALLOC_OBJ, ASSERT, log_history::capacity, and log_history_obj_init().

Referenced by man_persist_init().

◆ log_history_obj_init()

static void log_history_obj_init ( struct log_history h,
int  capacity 
)
static

◆ log_history_ref()

const struct log_entry* log_history_ref ( const struct log_history h,
const int  index 
)

Definition at line 4101 of file manage.c.

References log_history::array, log_index(), and log_history::size.

Referenced by man_history().

◆ log_history_resize()

void log_history_resize ( struct log_history h,
const int  capacity 
)

◆ log_index()

static int log_index ( const struct log_history h,
int  i 
)
inlinestatic

◆ man_accept()

static void man_accept ( struct management man)
static

◆ man_block()

static int man_block ( struct management man,
volatile int *  signal_received,
const time_t  expire 
)
static

◆ man_bytecount()

static void man_bytecount ( struct management man,
const int  update_seconds 
)
static

◆ man_bytecount_output_client()

static void man_bytecount_output_client ( struct management man,
counter_type  dco_read_bytes,
counter_type  dco_write_bytes 
)
static

◆ man_bytecount_output_server()

void man_bytecount_output_server ( const counter_type bytes_in_total,
const counter_type bytes_out_total,
struct man_def_auth_context mdac 
)

◆ man_certificate()

static void man_certificate ( struct management man)
static

◆ man_check_for_signals()

static bool man_check_for_signals ( volatile int *  signal_received)
static

◆ man_check_password()

static void man_check_password ( struct management man,
const char *  line 
)
static

◆ man_client_auth()

static void man_client_auth ( struct management man,
const char *  cid_str,
const char *  kid_str,
const bool  extra 
)
static

◆ man_client_deny()

static void man_client_deny ( struct management man,
const char *  cid_str,
const char *  kid_str,
const char *  reason,
const char *  client_reason 
)
static

◆ man_client_kill()

static void man_client_kill ( struct management man,
const char *  cid_str,
const char *  kill_msg 
)
static

◆ man_client_n_clients()

static void man_client_n_clients ( struct management man)
static

◆ man_client_pending_auth()

static void man_client_pending_auth ( struct management man,
const char *  cid_str,
const char *  kid_str,
const char *  extra,
const char *  timeout_str 
)
static

Will send a notification to the client that succesful authentication will require an additional step (web based SSO/2-factor auth/etc)

Parameters
manThe management interface struct
cid_strThe CID in string form
kid_strThe key ID in string form
extraThe string to be send to the client containing the information of the additional steps

Definition at line 1059 of file manage.c.

References management_callback::arg, man_persist::callback, management_callback::client_pending_auth, M_CLIENT, man_command_unsupported(), msg, parse_cid(), parse_uint(), and management::persist.

Referenced by man_dispatch_command().

◆ man_close_socket()

static void man_close_socket ( struct management man,
const socket_descriptor_t  sd 
)
static

◆ man_command_unsupported()

static void man_command_unsupported ( const char *  command_name)
static

◆ man_connect()

static void man_connect ( struct management man)
static

◆ man_connection_clear()

static void man_connection_clear ( struct man_connection mc)
static

◆ man_connection_close()

static void man_connection_close ( struct management man)
static

◆ man_connection_init()

static void man_connection_init ( struct management man)
static

◆ man_connection_settings_reset()

static void man_connection_settings_reset ( struct management man)
static

◆ man_delete_unix_socket()

static void man_delete_unix_socket ( struct management man)
static

◆ man_dispatch_command()

static void man_dispatch_command ( struct management man,
struct status_output so,
const char **  p,
const int  nparms 
)
static

◆ man_echo()

static void man_echo ( struct management man,
const char *  parm 
)
static

◆ man_env_filter()

static void man_env_filter ( struct management man,
const int  level 
)
static

Definition at line 1182 of file manage.c.

References management::connection, man_connection::env_filter_level, M_CLIENT, and msg.

Referenced by man_dispatch_command().

◆ man_forget_passwords()

static void man_forget_passwords ( struct management man)
static

Definition at line 798 of file manage.c.

References M_CLIENT, msg, ssl_clean_auth_token(), and ssl_purge_auth().

Referenced by man_dispatch_command().

◆ man_help()

static void man_help ( void  )
static

Definition at line 71 of file manage.c.

References M_CLIENT, msg, and title_string.

Referenced by man_dispatch_command().

◆ man_history()

static void man_history ( struct management man,
const char *  parm,
const char *  type,
struct log_history log,
bool *  realtime,
const unsigned int  lep_flags 
)
static

◆ man_hold()

static void man_hold ( struct management man,
const char *  cmd 
)
static

◆ man_io_error()

static bool man_io_error ( struct management man,
const char *  prefix 
)
static

Definition at line 2084 of file manage.c.

References D_MANAGEMENT, gc_free(), gc_new(), ignore_sys_error(), msg, and openvpn_errno_maybe_crt().

Referenced by man_read(), and man_write().

◆ man_kill()

static void man_kill ( struct management man,
const char *  victim 
)
static

◆ man_listen()

static void man_listen ( struct management man)
static

◆ man_load_stats()

static void man_load_stats ( struct management man)
static

◆ man_log()

static void man_log ( struct management man,
const char *  parm 
)
static

◆ man_mod_signal()

static int man_mod_signal ( const struct management man,
const int  signum 
)
static

◆ man_need()

static bool man_need ( struct management man,
const char **  p,
const int  n,
unsigned int  flags 
)
static

Checks if the correct number of arguments to a management command are present and otherwise prints an error and returns false.

Parameters
ppointer to the parameter array
nnumber of arguments required
flagsif MN_AT_LEAST require at least n parameters and not exactly n
Returns
Return whether p has n (or at least n) parameters

Definition at line 1249 of file manage.c.

References ASSERT, M_CLIENT, MN_AT_LEAST, and msg.

Referenced by man_dispatch_command().

◆ man_net()

static void man_net ( struct management man)
static

◆ man_new_connection_post()

static void man_new_connection_post ( struct management man,
const char *  description 
)
static

◆ man_output_env()

static void man_output_env ( const struct env_set es,
const bool  tail,
const int  env_filter_level,
const char *  prefix 
)
static

◆ man_output_extra_env()

static void man_output_extra_env ( struct management man,
const char *  prefix 
)
static

◆ man_output_list_push()

static void man_output_list_push ( struct management man,
const char *  str 
)
static

◆ man_output_list_push_finalize()

static void man_output_list_push_finalize ( struct management man)
static

◆ man_output_list_push_str()

static void man_output_list_push_str ( struct management man,
const char *  str 
)
static

◆ man_output_peer_info_env()

static void man_output_peer_info_env ( struct management man,
const struct man_def_auth_context mdac 
)
static

◆ man_output_standalone()

static void man_output_standalone ( struct management man,
volatile int *  signal_received 
)
static

◆ man_password_needed()

static bool man_password_needed ( struct management man)
inlinestatic

◆ man_persist_client_stats()

void man_persist_client_stats ( struct management man,
struct context c 
)

◆ man_persist_close()

static void man_persist_close ( struct man_persist mp)
static

◆ man_persist_init()

static void man_persist_init ( struct management man,
const int  log_history_cache,
const int  echo_buffer_size,
const int  state_buffer_size 
)
static

◆ man_persist_state()

static bool man_persist_state ( unsigned int *  persistent,
const int  n 
)
inlinestatic

Definition at line 3099 of file manage.c.

Referenced by management_socket_set().

◆ man_pk_sig()

static void man_pk_sig ( struct management man,
const char *  cmd_name 
)
static

◆ man_process_command()

static void man_process_command ( struct management man,
const char *  line 
)
static

◆ man_prompt()

static void man_prompt ( struct management man)
static

Definition at line 273 of file manage.c.

References man_output_list_push(), and man_password_needed().

Referenced by man_new_connection_post(), and man_read().

◆ man_proxy()

static void man_proxy ( struct management man,
const char **  p 
)
static

◆ man_query_need_ok()

static void man_query_need_ok ( struct management man,
const char *  type,
const char *  action 
)
static

◆ man_query_need_str()

static void man_query_need_str ( struct management man,
const char *  type,
const char *  action 
)
static

◆ man_query_password()

static void man_query_password ( struct management man,
const char *  type,
const char *  string 
)
static

◆ man_query_user_pass()

static void man_query_user_pass ( struct management man,
const char *  type,
const char *  string,
const bool  needed,
const char *  prompt,
char *  dest,
int  len 
)
static

◆ man_query_username()

static void man_query_username ( struct management man,
const char *  type,
const char *  string 
)
static

◆ man_read()

static int man_read ( struct management man)
static

◆ man_remote()

static void man_remote ( struct management man,
const char **  p 
)
static

◆ man_remote_entry_count()

static void man_remote_entry_count ( struct management man)
static

◆ man_remote_entry_get()

static void man_remote_entry_get ( struct management man,
const char *  p1,
const char *  p2 
)
static

◆ man_reset_client_socket()

static void man_reset_client_socket ( struct management man,
const bool  exiting 
)
static

◆ man_send_cc_message()

static void man_send_cc_message ( struct management man,
const char *  message,
const char *  parameters 
)
static

◆ man_settings_close()

static void man_settings_close ( struct man_settings ms)
static

Definition at line 2554 of file manage.c.

References CLEAR, and man_settings::local.

Referenced by management_close().

◆ man_settings_init()

static void man_settings_init ( struct man_settings ms,
const char *  addr,
const char *  port,
const char *  pass_file,
const char *  client_user,
const char *  client_group,
const int  log_history_cache,
const int  echo_buffer_size,
const int  state_buffer_size,
const int  remap_sigusr1,
const unsigned int  flags 
)
static

◆ man_signal()

static void man_signal ( struct management man,
const char *  name 
)
static

◆ man_standalone_event_loop()

static int man_standalone_event_loop ( struct management man,
volatile int *  signal_received,
const time_t  expire 
)
static

◆ man_standalone_ok()

static bool man_standalone_ok ( const struct management man)
inlinestatic

◆ man_start_ne32()

static void man_start_ne32 ( struct management man)
static

◆ man_state()

static void man_state ( struct management man,
const char *  parm 
)
static

◆ man_state_name()

static const char* man_state_name ( const int  state)
static

◆ man_status()

static void man_status ( struct management man,
const int  version,
struct status_output so 
)
static

◆ man_stop_ne32()

static void man_stop_ne32 ( struct management man)
static

◆ man_up_finalize()

static void man_up_finalize ( struct management man)
static

◆ man_update_io_state()

static void man_update_io_state ( struct management man)
static

◆ man_wait_for_client_connection()

static void man_wait_for_client_connection ( struct management man,
volatile int *  signal_received,
const time_t  expire,
unsigned int  flags 
)
static

◆ man_welcome()

static void man_welcome ( struct management man)
static

◆ man_write()

static int man_write ( struct management man)
static

◆ management_auth_failure()

void management_auth_failure ( struct management man,
const char *  type,
const char *  reason 
)

◆ management_auth_token()

void management_auth_token ( struct management man,
const char *  token 
)

Definition at line 3093 of file manage.c.

References M_CLIENT, and msg.

Referenced by add_option().

◆ management_check_bytecount()

void management_check_bytecount ( struct context c,
struct management man,
struct timeval *  timeval 
)

◆ management_clear_callback()

void management_clear_callback ( struct management man)

◆ management_close()

void management_close ( struct management man)

◆ management_connection_established()

void management_connection_established ( struct management management,
struct man_def_auth_context mdac,
const struct env_set es 
)

◆ management_echo()

void management_echo ( struct management man,
const char *  string,
const bool  pull 
)

◆ management_event_loop_n_seconds()

void management_event_loop_n_seconds ( struct management man,
int  sec 
)

◆ management_hold()

bool management_hold ( struct management man,
int  holdtime 
)

◆ management_init()

struct management* management_init ( void  )

◆ management_io()

void management_io ( struct management man)

◆ management_learn_addr()

void management_learn_addr ( struct management management,
struct man_def_auth_context mdac,
const struct mroute_addr addr,
const bool  primary 
)

◆ management_notify()

void management_notify ( struct management man,
const char *  severity,
const char *  type,
const char *  text 
)

Definition at line 2888 of file manage.c.

References M_CLIENT, and msg.

Referenced by receive_exit_message(), and server_pushed_signal().

◆ management_notify_client_close()

void management_notify_client_close ( struct management management,
struct man_def_auth_context mdac,
const struct env_set es 
)

◆ management_notify_client_cr_response()

void management_notify_client_cr_response ( unsigned  mda_key_id,
const struct man_def_auth_context mdac,
const struct env_set es,
const char *  response 
)

◆ management_notify_client_needing_auth()

void management_notify_client_needing_auth ( struct management management,
const unsigned int  mda_key_id,
struct man_def_auth_context mdac,
const struct env_set es 
)

◆ management_notify_generic()

void management_notify_generic ( struct management man,
const char *  str 
)

Definition at line 2894 of file manage.c.

References M_CLIENT, and msg.

Referenced by ce_management_query_proxy(), ce_management_query_remote(), and server_pushed_info().

◆ management_open()

bool management_open ( struct management man,
const char *  addr,
const char *  port,
const char *  pass_file,
const char *  client_user,
const char *  client_group,
const int  log_history_cache,
const int  echo_buffer_size,
const int  state_buffer_size,
const int  remap_sigusr1,
const unsigned int  flags 
)

◆ management_post_tunnel_open()

void management_post_tunnel_open ( struct management man,
const in_addr_t  tun_local_ip 
)

◆ management_pre_tunnel_close()

void management_pre_tunnel_close ( struct management man)

◆ management_query_cert()

char* management_query_cert ( struct management man,
const char *  cert_name 
)

◆ management_query_multiline()

static int management_query_multiline ( struct management man,
const char *  b64_data,
const char *  prompt,
const char *  cmd,
int *  state,
struct buffer_list **  input 
)
static

◆ management_query_multiline_flatten()

static char* management_query_multiline_flatten ( struct management man,
const char *  b64_data,
const char *  prompt,
const char *  cmd,
int *  state,
struct buffer_list **  input 
)
static

◆ management_query_multiline_flatten_newline()

static char* management_query_multiline_flatten_newline ( struct management man,
const char *  b64_data,
const char *  prompt,
const char *  cmd,
int *  state,
struct buffer_list **  input 
)
static

◆ management_query_pk_sig()

char* management_query_pk_sig ( struct management man,
const char *  b64_data,
const char *  algorithm 
)

Definition at line 3747 of file manage.c.

Referenced by get_sig_from_man().

◆ management_query_user_pass()

bool management_query_user_pass ( struct management man,
struct user_pass up,
const char *  type,
const unsigned int  flags,
const char *  static_challenge 
)

Definition at line 3482 of file manage.c.

Referenced by auth_user_pass_mgmt().

◆ management_set_callback()

void management_set_callback ( struct management man,
const struct management_callback cb 
)

◆ management_set_state()

void management_set_state ( struct management man,
const int  state,
const char *  detail,
const in_addr_t *  tun_local_ip,
const struct in6_addr *  tun_local_ip6,
const struct openvpn_sockaddr local,
const struct openvpn_sockaddr remote 
)

◆ management_should_daemonize()

bool management_should_daemonize ( struct management man)

◆ management_sleep()

void management_sleep ( const int  n)

A sleep function that services the management layer for n seconds rather than doing nothing.

Definition at line 4114 of file manage.c.

References management_event_loop_n_seconds(), sleep, and win32_sleep().

Referenced by dco_connect_wait(), do_up(), exec_command(), openvpn_connect(), openvpn_getaddrinfo(), read_incoming_link(), socket_listen_accept(), socket_restart_pause(), and tuntap_set_connected().

◆ management_socket_set()

void management_socket_set ( struct management man,
struct event_set es,
void *  arg,
unsigned int *  persistent 
)

◆ management_up_down()

void management_up_down ( struct management man,
const char *  updown,
const struct env_set es 
)

Definition at line 2878 of file manage.c.

References es, man_settings::flags, M_CLIENT, man_output_env(), MF_UP_DOWN, msg, and management::settings.

Referenced by do_close_tun(), and do_route().

◆ management_would_hold()

bool management_would_hold ( struct management man)

◆ parse_cid()

static bool parse_cid ( const char *  str,
unsigned long *  cid 
)
static

Definition at line 1021 of file manage.c.

References M_CLIENT, and msg.

Referenced by man_client_auth(), man_client_deny(), man_client_kill(), and man_client_pending_auth().

◆ parse_uint()

static bool parse_uint ( const char *  str,
const char *  what,
unsigned int *  uint 
)
static

Definition at line 1035 of file manage.c.

References M_CLIENT, and msg.

Referenced by man_client_auth(), man_client_deny(), and man_client_pending_auth().

◆ report_command_status()

static void report_command_status ( const bool  status,
const char *  command 
)
static

Small function to report the success or failure of a command to the management interface.

Definition at line 293 of file manage.c.

References M_CLIENT, msg, and status.

Referenced by in_extra_dispatch(), man_proxy(), and man_remote().

◆ set_client_version()

static void set_client_version ( struct management man,
const char *  version 
)
static

Definition at line 1320 of file manage.c.

References man_connection::client_version, and management::connection.

Referenced by man_dispatch_command().

◆ virtual_output_callback_func()

static void virtual_output_callback_func ( void *  arg,
const unsigned int  flags,
const char *  str 
)
static

Variable Documentation

◆ blank_up

const char blank_up[] = "[[BLANK]]"
static

Definition at line 61 of file manage.c.

Referenced by man_query_password(), and management_query_user_pass().

◆ management

Definition at line 63 of file manage.c.