OpenVPN
Macros | Functions | Variables
error.h File Reference
#include "basic.h"
#include <errno.h>
#include <stdbool.h>
#include <assert.h>
#include "errlevel.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ERR_BUF_SIZE   1280
 
#define OPENVPN_MSG_FP   stdout
 
#define OPENVPN_ERROR_FP   stderr
 
#define OPENVPN_EXIT_STATUS_GOOD   0
 
#define OPENVPN_EXIT_STATUS_ERROR   1
 
#define OPENVPN_EXIT_STATUS_USAGE   1
 
#define OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE   1
 
#define OPENVPN_DEBUG_FILE   PACKAGE ".log"
 
#define openvpn_errno()   GetLastError()
 
#define openvpn_strerror(e, gc)   strerror_win32(e, gc)
 
#define M_DEBUG_LEVEL   (0x0F) /* debug level mask */
 
#define M_FATAL   (1<<4) /* exit program */
 
#define M_NONFATAL   (1<<5) /* non-fatal error */
 
#define M_WARN   (1<<6) /* call syslog with LOG_WARNING */
 
#define M_DEBUG   (1<<7)
 
#define M_ERRNO   (1<<8) /* show errno description */
 
#define M_NOMUTE   (1<<11) /* don't do mute processing */
 
#define M_NOPREFIX   (1<<12) /* don't show date/time prefix */
 
#define M_USAGE_SMALL   (1<<13) /* fatal options error, call usage_small */
 
#define M_MSG_VIRT_OUT   (1<<14) /* output message through msg_status_output callback */
 
#define M_OPTERR   (1<<15) /* print "Options error:" prefix */
 
#define M_NOLF   (1<<16) /* don't print new line */
 
#define M_NOIPREFIX   (1<<17) /* don't print instance prefix */
 
#define M_ERR   (M_FATAL | M_ERRNO)
 
#define M_USAGE   (M_USAGE_SMALL | M_NOPREFIX | M_OPTERR)
 
#define M_CLIENT   (M_MSG_VIRT_OUT | M_NOMUTE | M_NOIPREFIX)
 
#define MUTE_LEVEL_SHIFT   24
 
#define MUTE_LEVEL_MASK   0xFF
 
#define ENCODE_MUTE_LEVEL(mute_level)   (((mute_level) & MUTE_LEVEL_MASK) << MUTE_LEVEL_SHIFT)
 
#define DECODE_MUTE_LEVEL(flags)   (((flags) >> MUTE_LEVEL_SHIFT) & MUTE_LEVEL_MASK)
 
#define LOGLEV(log_level, mute_level, other)   ((log_level) | ENCODE_MUTE_LEVEL(mute_level) | other)
 
#define EXIT_FATAL(flags)   do { if ((flags) & M_FATAL) {_exit(1);}} while (false)
 
#define msg   x_msg
 
#define dmsg   x_msg
 
#define SDL_CONSTRAIN   (1<<0)
 
#define ASSERT(x)   do { if (!(x)) {assert_failed(__FILE__, __LINE__, #x);}} while (false)
 
#define static_assert(expr, diagnostic)
 

Functions

const char * strerror_win32 (DWORD errnum, struct gc_arena *gc)
 
bool dont_mute (unsigned int flags)
 Check muting filter. More...
 
void x_msg (const unsigned int flags, const char *format,...)
 
void x_msg_va (const unsigned int flags, const char *format, va_list arglist)
 
void error_reset (void)
 
void errors_to_stderr (void)
 
void set_suppress_timestamps (bool suppressed)
 
void set_machine_readable_output (bool parsable)
 
bool set_debug_level (const int level, const unsigned int flags)
 
bool set_mute_cutoff (const int cutoff)
 
int get_debug_level (void)
 
int get_mute_cutoff (void)
 
const char * msg_flags_string (const unsigned int flags, struct gc_arena *gc)
 
FILE * msg_fp (const unsigned int flags)
 
void assert_failed (const char *filename, int line, const char *condition) __attribute__((__noreturn__))
 
static bool check_debug_level (unsigned int level)
 
static bool msg_test (unsigned int flags)
 Return true if flags represent an enabled, not muted log level. More...
 
void msg_forked (void)
 
void open_syslog (const char *pgmname, bool stdio_to_null)
 
void close_syslog (void)
 
void redirect_stdout_stderr (const char *file, bool append)
 
HANDLE get_orig_stderr (void)
 
void openvpn_exit (const int status)
 
void out_of_memory (void)
 
void reset_check_status (void)
 
void set_check_status (unsigned int info_level, unsigned int verbose_level)
 
void x_check_status (int status, const char *description, struct link_socket *sock, struct tuntap *tt)
 
static void check_status (int status, const char *description, struct link_socket *sock, struct tuntap *tt)
 
static void set_check_status_error_delay (unsigned int milliseconds)
 
void msg_thread_init (void)
 
void msg_thread_uninit (void)
 
static void msg_set_prefix (const char *prefix)
 
static const char * msg_get_prefix (void)
 
static void msg_set_virtual_output (const struct virtual_output *vo)
 
static const struct virtual_outputmsg_get_virtual_output (void)
 
static bool ignore_sys_error (const int err)
 
static unsigned int nonfatal (const unsigned int err)
 Convert fatal errors to nonfatal, don't touch other errors. More...
 

Variables

unsigned int x_debug_level
 
int x_msg_line_num
 
unsigned int x_cs_info_level
 
unsigned int x_cs_verbose_level
 
unsigned int x_cs_err_delay_ms
 
const char * x_msg_prefix
 
const struct virtual_outputx_msg_virtual_output
 

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   x)    do { if (!(x)) {assert_failed(__FILE__, __LINE__, #x);}} while (false)

Definition at line 221 of file error.h.

Referenced by add_env_item(), add_option(), add_route(), addr_defined_ipi(), addr_match(), addr_port_match(), addrlist_match(), addrlist_port_match(), adjust_power_of_2(), af_addr_size(), alloc_buf_sock_tun(), alloc_pull_filter(), argv_grow(), argv_printf_arglist(), argv_term(), ascii2ipset(), backend_tls_ctx_reload_crl(), bio_read(), bio_write(), buf_parse(), buffer_list_advance(), buffer_list_push_data(), buffer_read_from_file(), cert_hash_remember(), check_file_access_chroot(), check_fragment_dowork(), check_ping_restart_dowork(), check_ping_send_dowork(), check_replay_consistency(), check_send_occ_msg_dowork(), check_server_poll_timeout_dowork(), cipher_ctx_final_check_tag(), cipher_ctx_get_tag(), cipher_ctx_init(), cipher_ctx_update_ad(), cipher_kt_get(), cipher_kt_mode(), close_context(), close_tun(), construct_name_value(), create_socket(), create_socket_tcp(), create_socket_udp(), crypto_init_lib_engine(), crypto_pem_encode(), crypto_uninit_lib(), datagram_overhead(), delete_route(), do_ifconfig_ipv4(), do_init_crypto_none(), do_init_crypto_static(), do_init_crypto_tls(), do_init_crypto_tls_c1(), do_init_finalize_tls_frame(), do_init_fragment(), do_link_socket_new(), do_open_tun(), encrypt_sign(), env_set_add(), env_set_del(), env_set_inherit(), env_string_equal(), establish_http_proxy_passthru(), event_set_init_scalable(), event_set_init_simple(), extract_x509_field_ssl(), finish(), fragment_incoming(), fragment_outgoing(), fragment_prepend_flags(), fragment_ready_to_send(), frame_finalize(), frame_set_mtu_dynamic(), frequency_limit_init(), gc_addspecial(), get_console_input(), get_console_input_win32(), get_device_guid(), get_unspecified_device_guid(), get_win_sys_path(), hash_init(), hash_iterator_delete_element(), hash_iterator_init_range(), helper_client_server(), helper_keepalive(), hmac_ctx_init(), http_proxy_new(), ifconfig_pool_acquire(), ifconfig_pool_handle_to_ip_base(), ifconfig_pool_init(), ifconfig_pool_ip_base_to_handle(), ifconfig_pool_msg(), ifconfig_pool_persist_init(), ifconfig_pool_read(), in_src_get(), init_key_type(), init_ssl(), init_static(), ipset2ascii(), ipset2ascii_all(), is_dev_type(), key2_print(), key_ctx_update_implicit_iv(), key_direction_state_init(), key_method_1_read(), key_method_1_write(), key_method_2_read(), key_method_2_write(), key_state_read_ciphertext(), key_state_read_plaintext(), key_state_ssl_init(), key_state_write_ciphertext(), key_state_write_plaintext(), key_state_write_plaintext_const(), keyboard_input_available(), keydirection2ascii(), lame_duck_must_die(), link_socket_init_phase1(), link_socket_init_phase2(), link_socket_read(), link_socket_write(), link_socket_write_tcp(), linksock_print_addr(), log_history_add(), log_history_init(), log_history_resize(), make_arg_array(), make_base64_string2(), make_env_array(), make_inline_array(), man_dispatch_command(), man_io_error(), man_need(), man_query_user_pass(), man_read(), man_settings_init(), man_start_ne32(), man_up_finalize(), man_wait_for_client_connection(), management_io(), management_post_tunnel_open(), management_socket_set(), mbuf_add_item(), md_ctx_init(), md_kt_get(), modulo_add(), modulo_subtract(), move_session(), mroute_addr_mask_host_bits(), mroute_helper_add_iroute46(), mroute_helper_del_iroute46(), multi_close_instance(), multi_connection_established(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_get_instance_by_virtual_addr(), multi_get_timeout(), multi_init(), multi_learn_in_addr_t(), multi_process_drop_outgoing_tun(), multi_process_float(), multi_process_incoming_link(), multi_process_io_udp(), multi_process_outgoing_tun(), multi_push_restart_schedule_exit(), multi_schedule_context_wakeup(), multi_tcp_dispatch(), multi_tcp_init(), multi_tcp_instance_specific_init(), multi_tcp_process_io(), multi_tcp_process_outgoing_link_ready(), net_event_win32_start(), next_connection_entry(), ntlm_phase_3(), open_null(), open_tun(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_fd_set(), openvpn_getaddrinfo(), openvpn_main(), openvpn_PRF(), options_postprocess_filechecks(), options_postprocess_mutate(), options_string(), packet_id_init(), packet_id_test(), phase2_inetd(), phase2_tcp_server(), platform_sleep_until_signal(), plugin_call_item(), plugin_list_inherit(), plugin_open_item(), possibly_become_daemon(), print_opt_route(), print_opt_route_gateway(), print_signal(), print_sockaddr_ex(), priv_enc_CNG(), prng_bytes(), prng_init(), process_explicit_exit_notification_timer_wakeup(), process_io(), process_outgoing_link(), process_received_occ_msg(), proto_is_net(), proto_is_tcp(), proto_is_udp(), proto_remote(), protocol_dump(), push_option_ex(), query_user_add(), read_control_auth(), read_incoming_link(), read_incoming_tun(), read_inline_file(), read_key_file(), receive_auth_failed(), recv_line(), redirect_stdout_stderr(), reliable_ack_write(), reliable_get_buf(), reliable_init(), reliable_mark_active_incoming(), reliable_mark_active_outgoing(), reliable_mark_deleted(), remove_env_item(), resolve_remote(), route_list_add_vpn_gateway(), route_quota_exceeded(), rsa_priv_dec(), rsa_pub_dec(), rsa_pub_enc(), run_up_down(), schedule_detach_parent(), schedule_remove_entry(), schedule_rotate_up(), semaphore_lock(), semaphore_release(), send_line_crlf(), set_actual_address(), setenv_del(), setenv_str_ex(), setenv_str_incr(), socket_bind(), socket_do_listen(), socket_finalize(), socket_recv_queue(), socket_send_queue(), socket_set(), socks_process_outgoing_udp(), socks_proxy_new(), status_flush(), status_open(), status_read(), stream_buf_added(), stream_buf_get_final(), stream_buf_get_next(), stream_buf_read_setup_dowork(), stream_buf_set_next(), string_alloc_buf(), string_class(), string_mod(), string_null_terminate(), string_replace_leading(), swap_hmac(), test_crypto(), test_crypto_thread(), tls_authentication_status(), tls_check_ncp_cipher_list(), tls_crypt_unwrap(), tls_crypt_wrap(), tls_ctx_check_cert_time(), tls_ctx_client_new(), tls_ctx_free(), tls_ctx_initialised(), tls_ctx_load_ca(), tls_ctx_load_cert_file_and_copy(), tls_ctx_load_cryptoapi(), tls_ctx_load_dh_params(), tls_ctx_load_extra_certs(), tls_ctx_load_pkcs12(), tls_ctx_load_priv_file(), tls_ctx_restrict_ciphers(), tls_ctx_server_new(), tls_ctx_set_options(), tls_ctx_use_external_private_key(), tls_ctx_use_external_rsa_key(), tls_init_control_channel_frame_parameters(), tls_init_lib(), tls_multi_free(), tls_multi_init(), tls_post_encrypt(), tls_pre_decrypt(), tls_prepend_opcode_v1(), tls_prepend_opcode_v2(), tls_process(), tls_rec_payload(), tls_send_payload(), tls_session_generate_data_channel_keys(), tls_session_init(), tls_verify_crl_missing(), tun_finalize(), tun_read_queue(), tun_write_queue(), tunnel_server(), username_password_as_base64(), verify_callback(), verify_cert(), verify_user_pass(), we_ctl(), we_del(), we_del_index(), we_get_rw_indices(), we_init(), we_reset(), we_set_event(), win32_keyboard_get(), write_control_auth(), write_key(), x509_get_sha1_fingerprint(), and x509_get_sha256_fingerprint().

◆ DECODE_MUTE_LEVEL

#define DECODE_MUTE_LEVEL (   flags)    (((flags) >> MUTE_LEVEL_SHIFT) & MUTE_LEVEL_MASK)

Definition at line 124 of file error.h.

Referenced by dont_mute().

◆ dmsg

#define dmsg   x_msg

Definition at line 174 of file error.h.

Referenced by adapter_index_of_ip(), bio_read(), bio_write(), check_coarse_timers_dowork(), check_ping_send_dowork(), check_send_occ_msg_dowork(), check_stale_routes(), check_timeout_random_component_dowork(), close_tun(), crypto_pem_decode(), do_open_tun(), establish_http_proxy_passthru(), event_timeout_trigger(), fixup_key(), fragment_incoming(), fragment_prepend_flags(), frame_set_mtu_dynamic(), generate_key_random(), get_auth_challenge(), get_default_gateway_row(), get_panel_reg(), get_tap_reg(), info_callback(), init_key_ctx(), init_route_ipv6_list(), init_route_list(), interval_action(), interval_future_trigger(), interval_schedule_wakeup(), interval_test(), io_wait_dowork(), key2_print(), key_des_num_cblocks(), key_source_print(), key_state_export_keying_material(), link_socket_bad_outgoing_addr(), link_socket_write_tcp(), move_session(), mroute_helper_regenerate(), mss_fixup_dowork(), multi_close_instance(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_get_instance_by_virtual_addr(), multi_get_queue(), multi_reap_range(), multi_tcp_action(), multi_tcp_dispatch(), multi_tcp_post(), multi_tcp_process_outgoing_link(), multi_tcp_process_outgoing_link_ready(), multi_tcp_wait_lite(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_getaddrinfo(), packet_id_free(), packet_id_init(), packet_id_persist_load(), packet_id_persist_save(), phase2_inetd(), platform_test_file(), plugin_call_item(), plugin_open_item(), prng_init(), process_incoming_link_part2(), process_incoming_tun(), process_outgoing_tun(), process_received_occ_msg(), redirect_default_route_to_vpn(), reliable_ack_acknowledge_packet_id(), reliable_ack_read(), reliable_ack_read_packet_id(), reliable_ack_write(), reliable_can_get(), reliable_can_send(), reliable_get_buf_output_sequenced(), reliable_mark_active_incoming(), reliable_mark_active_outgoing(), reliable_not_replay(), reliable_schedule_now(), reliable_send(), reliable_send_purge(), reliable_send_timeout(), reliable_wont_break_sequentiality(), resolve_remote(), semaphore_close(), semaphore_lock(), semaphore_open(), semaphore_release(), shaper_soonest_event(), socket_finalize(), socket_recv_queue(), socket_send_queue(), socket_set_tcp_nodelay(), stream_buf_added(), stream_buf_get_final(), stream_buf_get_next(), stream_buf_init(), stream_buf_read_setup_dowork(), stream_buf_reset(), stream_buf_set_next(), tls1_P_hash(), tls1_PRF(), tls_authentication_status(), tls_crypt_unwrap(), tls_crypt_wrap(), tls_multi_process(), tls_pre_decrypt(), tls_pre_decrypt_lite(), tls_pre_encrypt(), tls_process(), tls_session_init(), tls_update_remote_addr(), tun_finalize(), tun_read_queue(), tun_write_queue(), verify_user_pass(), we_ctl(), we_init(), we_wait(), win_wfp_block_dns(), win_wfp_uninit(), and windows_route_find_if_index().

◆ ENCODE_MUTE_LEVEL

#define ENCODE_MUTE_LEVEL (   mute_level)    (((mute_level) & MUTE_LEVEL_MASK) << MUTE_LEVEL_SHIFT)

Definition at line 123 of file error.h.

◆ ERR_BUF_SIZE

#define ERR_BUF_SIZE   1280

Definition at line 39 of file error.h.

Referenced by log_entry_print(), plugin_vlog(), and x_msg_va().

◆ EXIT_FATAL

#define EXIT_FATAL (   flags)    do { if ((flags) & M_FATAL) {_exit(1);}} while (false)

Definition at line 147 of file error.h.

◆ LOGLEV

#define LOGLEV (   log_level,
  mute_level,
  other 
)    ((log_level) | ENCODE_MUTE_LEVEL(mute_level) | other)

Definition at line 136 of file error.h.

◆ M_CLIENT

#define M_CLIENT   (M_MSG_VIRT_OUT | M_NOMUTE | M_NOIPREFIX)

◆ M_DEBUG

#define M_DEBUG   (1<<7)

Definition at line 97 of file error.h.

Referenced by msg_flags_string().

◆ M_DEBUG_LEVEL

#define M_DEBUG_LEVEL   (0x0F) /* debug level mask */

Definition at line 92 of file error.h.

Referenced by check_debug_level().

◆ M_ERR

#define M_ERR   (M_FATAL | M_ERRNO)

◆ M_ERRNO

#define M_ERRNO   (1<<8) /* show errno description */

◆ M_FATAL

#define M_FATAL   (1<<4) /* exit program */

Definition at line 94 of file error.h.

Referenced by add_route(), add_route_ipv6(), array_mult_safe(), assert_failed(), at_least_one_tap_win(), backend_tls_ctx_reload_crl(), bad_address_length(), buf_size_error(), check_replay_consistency(), cipher_ctx_init(), cipher_ctx_update(), cipher_ctx_update_ad(), clone_push_list(), context_gc_free(), crypto_pem_decode(), delete_route(), delete_route_ipv6(), dhcp_masq_addr(), dll_resolve_symbol(), do_close_tun(), do_genkey(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_init_crypto_tls_c1(), do_init_tls_wrap_key(), do_open_tun(), do_persist_tuntap(), frame_finalize(), generate_key_random(), get_console_input(), get_highest_preference_tls_cipher(), get_ip_addr(), get_panel_reg(), get_tap_reg(), get_user_pass_cr(), http_proxy_new(), index_verify(), init_key_type(), init_net_event_win32(), init_tun(), is_tun_p2p(), key_state_ssl_init(), md_kt_get(), msg_flags_string(), msg_fp(), multi_tcp_action(), multi_tcp_dispatch(), multi_tcp_post(), multi_tcp_wait_lite(), must_have_n_keys(), netcmd_semaphore_lock(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), next_connection_entry(), nonfatal(), open_null(), open_tun(), openvpn_execve_allowed(), openvpn_execve_check(), openvpn_getaddrinfo(), openvpn_popen(), options_postprocess_mutate_ce(), platform_chroot(), platform_group_get(), platform_user_get(), plugin_init_item(), plugin_open_item(), plugin_option_list_print(), prng_reset_nonce(), random_bytes_to_buf(), read_inline_file(), read_key_file(), reset_net_event_win32(), resolve_bind_local(), run_up_down(), sd_close(), set_mtu_discover_type(), set_win_sys_path_via_env(), show_available_curves(), show_available_tls_ciphers(), socket_bind(), tap_allow_nonadmin_access(), test_crypto(), tls_crypt_init_key(), tls_ctx_add_extra_certs(), tls_ctx_client_new(), tls_ctx_load_ca(), tls_ctx_load_cert_file_and_copy(), tls_ctx_load_cryptoapi(), tls_ctx_load_dh_params(), tls_ctx_load_ecdh_params(), tls_ctx_load_extra_certs(), tls_ctx_load_pkcs12(), tls_ctx_load_priv_file(), tls_ctx_restrict_ciphers(), tls_ctx_server_new(), tls_ctx_set_cert_profile(), tls_ctx_use_external_private_key(), tls_verify_crl_missing(), translate_mtu_discover_type_name(), verify_255_255_255_252(), verify_fix_key2(), verify_user_pass(), virtual_output_callback_func(), we_ctl(), we_set_event(), win32_signal_open(), win32_version_info(), and x_msg_va().

◆ M_MSG_VIRT_OUT

#define M_MSG_VIRT_OUT   (1<<14) /* output message through msg_status_output callback */

Definition at line 104 of file error.h.

Referenced by openvpn_getaddrinfo(), parse_line(), and x_msg_va().

◆ M_NOIPREFIX

#define M_NOIPREFIX   (1<<17) /* don't print instance prefix */

Definition at line 107 of file error.h.

Referenced by plugin_vlog(), and x_msg_va().

◆ M_NOLF

#define M_NOLF   (1<<16) /* don't print new line */

Definition at line 106 of file error.h.

Referenced by x_msg_va().

◆ M_NOMUTE

#define M_NOMUTE   (1<<11) /* don't do mute processing */

Definition at line 101 of file error.h.

Referenced by dont_mute(), and plugin_vlog().

◆ M_NONFATAL

#define M_NONFATAL   (1<<5) /* non-fatal error */

◆ M_NOPREFIX

#define M_NOPREFIX   (1<<12) /* don't show date/time prefix */

◆ M_OPTERR

#define M_OPTERR   (1<<15) /* print "Options error:" prefix */

◆ M_USAGE

#define M_USAGE   (M_USAGE_SMALL | M_NOPREFIX | M_OPTERR)

◆ M_USAGE_SMALL

#define M_USAGE_SMALL   (1<<13) /* fatal options error, call usage_small */

Definition at line 103 of file error.h.

Referenced by msg_fp(), and x_msg_va().

◆ M_WARN

#define M_WARN   (1<<6) /* call syslog with LOG_WARNING */

Definition at line 96 of file error.h.

Referenced by add_entry(), add_option(), add_route_ipapi(), apply_pull_filter(), backend_tls_ctx_reload_crl(), block_dns_msg_handler(), build_dhcp_options_string(), check_addr_clash(), check_file_access(), check_subnet_conflict(), close_net_event_win32(), close_tun(), crypto_init_lib_engine(), del_route_ipapi(), dhcp_release_by_adapter_index(), dhcp_renew_by_adapter_index(), do_address_service(), do_deferred_options(), do_dns6_service(), do_init_crypto_none(), do_init_frame(), do_option_warnings(), do_route(), do_route_service(), env_block(), event_set_init_scalable(), foreign_option(), fork_to_self(), frame_finalize(), get_user_pass_cr(), ifconfig_sanity_check(), init_key_ctx(), init_key_type(), init_route(), init_route_ipv6(), init_route_ipv6_list(), init_route_list(), init_ssl(), init_static(), ipv6_addr_safe_hexplusbits(), key_state_export_keying_material(), learn_address_script(), link_socket_close(), link_socket_connection_initiated(), link_socket_init_phase2(), link_socket_read_tcp(), make_arg_array(), man_check_password(), management_callback_proxy_cmd(), mroute_extract_addr_ip(), msg_flags_string(), msglevel_forward_compatible(), multi_client_disconnect_script(), multi_connection_established(), net_event_win32_reset_write(), open_management(), open_null(), open_syslog(), open_tun(), openvpn_execve(), openvpn_execve_allowed(), openvpn_execve_check(), openvpn_getaddrinfo(), openvpn_popen(), options_postprocess_http_proxy_override(), options_postprocess_mutate(), options_postprocess_verify_ce(), options_warning_safe(), output_peer_info_env(), overlapped_io_close(), phase2_inetd(), platform_create_temp_file(), platform_mlockall(), platform_nice(), platform_test_file(), plugin_call_item(), plugin_close_item(), plugin_init_item(), plugin_vlog(), purge_user_pass(), redirect_default_route_to_vpn(), redirect_stdout_stderr(), register_dns_service(), semaphore_open(), semaphore_release(), send_push_options(), set_lladdr(), set_user_script(), setenv_str_safe(), show_available_ciphers(), show_available_curves(), show_routes(), socket_do_accept(), socket_listen_accept(), socket_set_mark(), socket_set_rcvbuf(), socket_set_sndbuf(), socket_set_tcp_nodelay(), SSL_CTX_use_CryptoAPI_certificate(), status_flush(), status_open(), stream_buf_added(), tap_allow_nonadmin_access(), tls_check_ncp_cipher_list(), tls_crypt_kt(), tls_ctx_check_cert_time(), tls_ctx_load_ca(), tls_ctx_load_priv_file(), tls_ctx_reload_crl(), tls_ctx_restrict_ciphers(), tls_ctx_set_cert_profile(), tls_ctx_use_external_private_key(), tls_limit_reneg_bytes(), translate_mtu_discover_type_name(), usage_small(), verify_cert(), verify_permission(), warn_on_use_of_common_subnets(), win32_signal_open(), win_block_dns_service(), win_get_tempdir(), win_trigger_event(), win_wfp_block_dns(), windows_route_find_if_index(), write_dhcp_str(), write_dhcp_u32_array(), write_dhcp_u8(), x509_verify_ns_cert_type(), and x_msg_va().

◆ msg

#define msg   x_msg

Definition at line 173 of file error.h.

Referenced by add_client_nat_to_option_list(), add_entry(), add_option(), add_proxy_headers(), add_route(), add_route_ipapi(), add_route_ipv6(), add_routes(), af_addr_size(), alloc_connection_entry(), alloc_remote_entry(), apply_pull_filter(), argv_msg(), argv_msg_prefix(), array_mult_safe(), ascii2keydirection(), assert_failed(), at_least_one_tap_win(), auth_retry_set(), backend_tls_ctx_reload_crl(), bad_address_length(), block_dns_msg_handler(), buf_size_error(), buffer_write_file(), build_dhcp_options_string(), calc_options_string_link_mtu(), check_add_routes_dowork(), check_addr_clash(), check_cmd_access(), check_file_access(), check_inactivity_timeout_dowork(), check_incoming_control_channel_dowork(), check_ping_restart_dowork(), check_replay_consistency(), check_send_occ_load_test_dowork(), check_send_occ_req_dowork(), check_server_poll_timeout_dowork(), check_subnet_conflict(), check_tls_errors_co(), cipher_kt_get(), close_net_event_win32(), close_tun(), cmprintf_tap(), context_gc_free(), context_init_1(), create_socket(), create_socket_tcp(), create_socket_udp(), crypto_adjust_frame_parameters(), crypto_check_replay(), crypto_init_lib_engine(), crypto_print_openssl_errors(), crypto_read_openvpn_key(), del_route_ipapi(), delete_route(), delete_route_ipv6(), delete_temp_addresses(), dhcp_extract_router_msg(), dhcp_masq_addr(), dhcp_option_address_parse(), dhcp_option_dns6_parse(), dhcp_release_by_adapter_index(), dhcp_renew_by_adapter_index(), dll_resolve_symbol(), do_address_service(), do_close_check_if_restart_permitted(), do_close_tun(), do_close_tun_simple(), do_compute_occ_strings(), do_deferred_options(), do_dns6_service(), do_genkey(), do_ifconfig(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_init_crypto_none(), do_init_crypto_static(), do_init_crypto_tls_c1(), do_init_frame(), do_init_tls_wrap_key(), do_open_tun(), do_option_warnings(), do_persist_tuntap(), do_route(), do_route_ipv4_service(), do_route_ipv6_service(), do_route_service(), do_setenv_x509(), do_setup_fast_io(), do_test_crypto(), do_uid_gid_chroot(), do_up(), dont_mute(), drop_if_recursive_routing(), env_block(), env_set_print(), establish_http_proxy_passthru(), establish_socks_proxy_passthru(), establish_socks_proxy_udpassoc(), event_set_init_scalable(), extract_x509_field_ssl(), finish(), foreign_option(), fork_to_self(), fragment_incoming(), fragment_outgoing(), fragment_ttl_reap(), frame_finalize(), frame_print(), frequency_limit_event_allowed(), generate_key_expansion(), generate_key_random(), get_adapter_index(), get_adapter_index_flexible(), get_adapter_info_list(), get_console_input(), get_default_gateway_ipv6(), get_interface_info_list(), get_ipv6_addr(), get_panel_reg(), get_per_adapter_info(), get_proxy_authenticate(), get_special_addr(), get_tap_reg(), get_user_pass_cr(), get_user_pass_http(), get_windows_routing_table(), HandleMessage(), helper_client_server(), helper_keepalive(), http_proxy_new(), ifconfig_pool_init(), ifconfig_pool_read(), ifconfig_pool_verify_range(), ifconfig_pool_write(), ifconfig_sanity_check(), ignore_restart_signals(), in_extra_dispatch(), incoming_push_message(), index_verify(), init_key_ctx(), init_key_type(), init_net_event_win32(), init_route(), init_route_ipv6(), init_route_ipv6_list(), init_route_list(), init_ssl(), init_static(), init_tun(), init_win32(), initialization_sequence_completed(), ip_addr_string_to_array(), ipconfig_register_dns(), is_ipv6(), is_tun_p2p(), key_des_fixup(), key_is_zero(), key_method_1_read(), key_method_1_write(), key_method_2_read(), key_method_2_write(), key_state_export_keying_material(), learn_address_script(), link_socket_bad_incoming_addr(), link_socket_close(), link_socket_connection_initiated(), link_socket_init_phase2(), link_socket_read_tcp(), linksock_print_addr(), local_options_string(), log_entry_print(), man_bytecount(), man_bytecount_output_client(), man_certificate(), man_check_password(), man_connect(), man_dispatch_command(), man_forget_passwords(), man_help(), man_history(), man_hold(), man_io_error(), man_kill(), man_listen(), man_load_stats(), man_need(), man_net(), man_new_connection_post(), man_output_env(), man_pk_sig(), man_process_command(), man_proxy(), man_query_user_pass(), man_record_peer_info(), man_remote(), man_reset_client_socket(), man_settings_init(), man_signal(), man_status(), man_wait_for_client_connection(), man_welcome(), management_auth_failure(), management_auth_token(), management_callback_proxy_cmd(), management_delete_event(), management_hold(), management_notify(), management_notify_generic(), management_query_multiline(), management_query_user_pass(), management_show_net_callback(), management_up_down(), mbuf_add_item(), mbuf_dereference_instance(), move_session(), mroute_extract_addr_ip(), mroute_learnable_address(), MsgToEventLog(), multi_add_iroutes(), multi_add_mbuf(), multi_bcast(), multi_client_disconnect_script(), multi_connection_established(), multi_create_instance(), multi_create_instance_tcp(), multi_delete_dup(), multi_get_create_instance_udp(), multi_init(), multi_learn_addr(), multi_print_status(), multi_process_drop_outgoing_tun(), multi_process_float(), multi_process_incoming_link(), multi_process_incoming_tun(), multi_process_post(), multi_select_virtual_addr(), multi_tcp_action(), multi_tcp_dispatch(), multi_tcp_init(), multi_tcp_instance_specific_init(), multi_tcp_post(), multi_tcp_wait_lite(), must_have_n_keys(), my_conv(), net_event_win32_reset_write(), netcmd_semaphore_lock(), netsh_command(), netsh_ifconfig(), netsh_ifconfig_options(), next_connection_entry(), no_more_than_n_args(), notnull(), ntlm_phase_3(), open_management(), open_null(), open_syslog(), open_tun(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_execve(), openvpn_execve_allowed(), openvpn_execve_check(), openvpn_getaddrinfo(), openvpn_main(), openvpn_popen(), openvpn_run_script(), option_iroute(), option_iroute_ipv6(), options_cmp_equal_safe(), options_postprocess_filechecks(), options_postprocess_http_proxy_override(), options_postprocess_mutate(), options_postprocess_mutate_ce(), options_postprocess_verify_ce(), options_server_import(), options_warning_safe_scan2(), output_peer_info_env(), overlapped_io_close(), overlapped_io_init(), packet_id_persist_close(), packet_id_persist_load(), packet_id_persist_print(), packet_id_persist_save(), parse_argv(), parse_hash_fingerprint(), parse_line(), parse_topology(), phase2_inetd(), platform_chroot(), platform_create_temp_file(), platform_group_get(), platform_group_set(), platform_mlockall(), platform_nice(), platform_test_file(), platform_user_get(), platform_user_set(), plugin_call_item(), plugin_close_item(), plugin_init_item(), plugin_open_item(), plugin_option_list_print(), plugin_return_free(), plugin_show_string_array(), plugin_vlog(), possibly_become_daemon(), prepare_push_reply(), print_client_nat_list(), print_default_gateway(), print_details(), print_pkt(), print_route(), print_route_option(), print_route_options(), print_signal(), priv_enc_CNG(), prng_reset_nonce(), process_explicit_exit_notification_init(), process_incoming_link_part1(), process_outgoing_link(), process_outgoing_tun(), process_received_occ_msg(), purge_user_pass(), push_option_ex(), push_remove_option(), random_bytes_to_buf(), read_config_file(), read_control_auth(), read_incoming_link(), read_incoming_tun(), read_inline_file(), read_key(), read_key_file(), receive_auth_failed(), recv_line(), recv_socks_reply(), redirect_default_route_to_vpn(), redirect_stdout_stderr(), register_dns_service(), reliable_send_purge(), remap_redirect_gateway_flags(), remove_iroutes_from_push_route_list(), reset_net_event_win32(), resolve_bind_local(), resolve_remote(), ReturnProcessId(), route_quota_exceeded(), run_up_down(), save_inetd_socket_descriptor(), schedule_exit(), sd_close(), semaphore_lock(), semaphore_open(), semaphore_release(), send_control_channel_string(), send_line(), send_push_options(), send_push_request(), server_pushed_signal(), set_cloexec(), set_lladdr(), set_mtu_discover_type(), set_nonblock(), set_user_script(), set_win_sys_path_via_env(), setenv_str_ex(), setenv_str_incr(), setenv_str_safe(), shaper_msg(), show_adapter(), show_adapters(), show_available_ciphers(), show_available_curves(), show_connection_entries(), show_connection_entry(), show_dhcp_option_addrs(), show_http_proxy_options(), show_library_versions(), show_p2mp_parms(), show_pull_filter_list(), show_routes(), show_settings(), show_tap_win_adapters(), show_windows_version(), socket_bind(), socket_connect(), socket_do_accept(), socket_do_listen(), socket_finalize(), socket_listen_accept(), socket_restart_pause(), socket_set_buffers(), socket_set_mark(), socket_set_rcvbuf(), socket_set_sndbuf(), socket_set_tcp_nodelay(), socks_handshake(), socks_username_password_auth(), ssl_ctx_set_rsakey(), SSL_CTX_use_CryptoAPI_certificate(), ssl_set_auth_token(), status_flush(), status_open(), status_printf(), stream_buf_added(), string_defined_equal(), string_replace_leading(), tap_allow_nonadmin_access(), tap_allow_nonadmin_access_handle(), tcp_connection_established(), test_crypto(), test_routes(), tls_check_ncp_cipher_list(), tls_crypt_adjust_frame_parameters(), tls_crypt_init_key(), tls_crypt_kt(), tls_crypt_wrap(), tls_ctx_check_cert_time(), tls_ctx_load_ca(), tls_ctx_load_dh_params(), tls_ctx_load_ecdh_params(), tls_ctx_reload_crl(), tls_ctx_restrict_ciphers(), tls_ctx_set_cert_profile(), tls_ctx_set_tls_versions(), tls_limit_reneg_bytes(), tls_lock_username(), tls_multi_process(), tls_poor_mans_ncp(), tls_pre_decrypt(), tls_prepend_opcode_v1(), tls_prepend_opcode_v2(), tls_process(), tls_session_generate_data_channel_keys(), tls_session_update_crypto_params(), translate_mtu_discover_type_name(), tun_finalize(), tun_show_debug(), tun_standby(), tunnel_server_tcp(), tunnel_server_udp_single_threaded(), usage_small(), usage_version(), verify_255_255_255_252(), verify_callback(), verify_cert(), verify_cert_call_command(), verify_cert_call_plugin(), verify_cert_export_cert(), verify_check_crl_dir(), verify_common_subnet(), verify_final_auth_checks(), verify_fix_key2(), verify_peer_cert(), verify_permission(), verify_user_pass(), verify_user_pass_plugin(), verify_user_pass_script(), warn_on_use_of_common_subnets(), we_ctl(), we_init(), we_set_event(), win32_pause(), win32_signal_close(), win32_signal_open(), win32_version_info(), win32_version_string(), win_block_dns_service(), win_ctrl_handler(), win_get_tempdir(), win_trigger_event(), win_wfp_block_dns(), win_wfp_uninit(), windows_route_find_if_index(), write_dhcp_str(), write_dhcp_u32_array(), write_dhcp_u8(), write_pid(), x509_track_add(), x509_verify_cert_eku(), x509_verify_cert_ku(), x509_verify_ns_cert_type(), x509_write_pem(), x_check_status(), and x_msg_va().

◆ MUTE_LEVEL_MASK

#define MUTE_LEVEL_MASK   0xFF

Definition at line 121 of file error.h.

◆ MUTE_LEVEL_SHIFT

#define MUTE_LEVEL_SHIFT   24

Definition at line 120 of file error.h.

◆ OPENVPN_DEBUG_FILE

#define OPENVPN_DEBUG_FILE   PACKAGE ".log"

Definition at line 69 of file error.h.

Referenced by error_reset().

◆ openvpn_errno

#define openvpn_errno ( )    GetLastError()

◆ OPENVPN_ERROR_FP

#define OPENVPN_ERROR_FP   stderr

Definition at line 49 of file error.h.

Referenced by errors_to_stderr().

◆ OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE

#define OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE   1

Definition at line 58 of file error.h.

Referenced by error_reset(), and msg_fp().

◆ OPENVPN_EXIT_STATUS_ERROR

#define OPENVPN_EXIT_STATUS_ERROR   1

Definition at line 56 of file error.h.

Referenced by openvpn_exit(), and x_msg_va().

◆ OPENVPN_EXIT_STATUS_GOOD

#define OPENVPN_EXIT_STATUS_GOOD   0

Definition at line 55 of file error.h.

Referenced by add_option(), openvpn_exit(), and openvpn_main().

◆ OPENVPN_EXIT_STATUS_USAGE

#define OPENVPN_EXIT_STATUS_USAGE   1

Definition at line 57 of file error.h.

Referenced by usage(), usage_small(), and usage_version().

◆ OPENVPN_MSG_FP

#define OPENVPN_MSG_FP   stdout

Definition at line 48 of file error.h.

Referenced by error_reset().

◆ openvpn_strerror

#define openvpn_strerror (   e,
  gc 
)    strerror_win32(e, gc)

Definition at line 75 of file error.h.

◆ SDL_CONSTRAIN

#define SDL_CONSTRAIN   (1<<0)

Definition at line 203 of file error.h.

Referenced by add_option(), init_verb_mute(), and set_debug_level().

◆ static_assert

#define static_assert (   expr,
  diagnostic 
)
Value:
extern int (*__OpenVPN_static_assert_function(void)) \
[!!sizeof(struct { int __error_if_negative : (expr) ? 2 : -1; })]

Definition at line 232 of file error.h.

Referenced by format_hex_ex().

Function Documentation

◆ assert_failed()

void assert_failed ( const char *  filename,
int  line,
const char *  condition 
)

Definition at line 434 of file error.c.

References M_FATAL, mock_assert(), and msg.

◆ check_debug_level()

static bool check_debug_level ( unsigned int  level)
inlinestatic

◆ check_status()

static void check_status ( int  status,
const char *  description,
struct link_socket sock,
struct tuntap tt 
)
inlinestatic

◆ close_syslog()

void close_syslog ( void  )

Definition at line 483 of file error.c.

References free, and use_syslog.

Referenced by msg_test(), and openvpn_exit().

◆ dont_mute()

bool dont_mute ( unsigned int  flags)

Check muting filter.

Definition at line 399 of file error.c.

References DECODE_MUTE_LEVEL, M_INFO, M_NOMUTE, msg, mute_category, mute_count, and mute_cutoff.

Referenced by msg_test(), and x_msg_va().

◆ error_reset()

void error_reset ( void  )

◆ errors_to_stderr()

void errors_to_stderr ( void  )

Definition at line 186 of file error.c.

References default_err, and OPENVPN_ERROR_FP.

Referenced by add_option().

◆ get_debug_level()

int get_debug_level ( void  )

Definition at line 138 of file error.c.

References x_debug_level.

Referenced by man_dispatch_command().

◆ get_mute_cutoff()

int get_mute_cutoff ( void  )

Definition at line 144 of file error.c.

References mute_cutoff.

Referenced by man_dispatch_command().

◆ get_orig_stderr()

HANDLE get_orig_stderr ( void  )

Definition at line 504 of file error.c.

References orig_stderr.

Referenced by get_console_input_win32(), and msg_test().

◆ ignore_sys_error()

static bool ignore_sys_error ( const int  err)
inlinestatic

Definition at line 366 of file error.h.

Referenced by man_io_error(), and x_check_status().

◆ msg_flags_string()

const char* msg_flags_string ( const unsigned int  flags,
struct gc_arena gc 
)

Definition at line 787 of file error.c.

References alloc_buf_gc(), BSTR, buf_printf(), M_DEBUG, M_FATAL, M_INFO, M_NONFATAL, and M_WARN.

Referenced by log_entry_print().

◆ msg_forked()

void msg_forked ( void  )

Definition at line 100 of file error.c.

References forked.

Referenced by msg_test().

◆ msg_fp()

FILE* msg_fp ( const unsigned int  flags)

◆ msg_get_prefix()

static const char* msg_get_prefix ( void  )
inlinestatic

Definition at line 336 of file error.h.

References x_msg_prefix, and x_msg_virtual_output.

Referenced by x_msg_va().

◆ msg_get_virtual_output()

static const struct virtual_output* msg_get_virtual_output ( void  )
static

Definition at line 356 of file error.h.

References x_msg_virtual_output.

Referenced by x_msg_va().

◆ msg_set_prefix()

static void msg_set_prefix ( const char *  prefix)
inlinestatic

Definition at line 330 of file error.h.

Referenced by clear_prefix(), and set_prefix().

◆ msg_set_virtual_output()

static void msg_set_virtual_output ( const struct virtual_output vo)
inlinestatic

Definition at line 350 of file error.h.

Referenced by man_persist_close(), and man_persist_init().

◆ msg_test()

static bool msg_test ( unsigned int  flags)
inlinestatic

◆ msg_thread_init()

void msg_thread_init ( void  )

◆ msg_thread_uninit()

void msg_thread_uninit ( void  )

◆ nonfatal()

static unsigned int nonfatal ( const unsigned int  err)
inlinestatic

Convert fatal errors to nonfatal, don't touch other errors.

Definition at line 396 of file error.h.

References M_FATAL, and M_NONFATAL.

◆ open_syslog()

void open_syslog ( const char *  pgmname,
bool  stdio_to_null 
)

Definition at line 459 of file error.c.

References M_WARN, msg, msgfp, PACKAGE, set_std_files_to_null(), std_redir, string_alloc(), and use_syslog.

Referenced by add_option(), and msg_test().

◆ openvpn_exit()

void openvpn_exit ( const int  status)

◆ out_of_memory()

void out_of_memory ( void  )

Definition at line 452 of file error.c.

References PACKAGE_NAME.

Referenced by check_malloc_return(), and msg_test().

◆ redirect_stdout_stderr()

void redirect_stdout_stderr ( const char *  file,
bool  append 
)

Definition at line 519 of file error.c.

References ASSERT, gc_free(), gc_new(), M_ERR, M_ERRNO, M_WARN, msg, msgfp, orig_stderr, S_IRUSR, S_IWUSR, std_redir, and wide_string().

Referenced by add_option(), and msg_test().

◆ reset_check_status()

void reset_check_status ( void  )

Definition at line 638 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_static(), and msg_test().

◆ set_check_status()

void set_check_status ( unsigned int  info_level,
unsigned int  verbose_level 
)

Definition at line 645 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_verb_mute(), and msg_test().

◆ set_check_status_error_delay()

static void set_check_status_error_delay ( unsigned int  milliseconds)
inlinestatic

Definition at line 311 of file error.h.

References msg_thread_init(), msg_thread_uninit(), and x_msg_prefix.

Referenced by init_instance().

◆ set_debug_level()

bool set_debug_level ( const int  level,
const unsigned int  flags 
)

Definition at line 106 of file error.c.

References constrain_int(), SDL_CONSTRAIN, and x_debug_level.

Referenced by add_option(), init_verb_mute(), and man_dispatch_command().

◆ set_machine_readable_output()

void set_machine_readable_output ( bool  parsable)

Definition at line 156 of file error.c.

References machine_readable_output.

Referenced by add_option().

◆ set_mute_cutoff()

bool set_mute_cutoff ( const int  cutoff)

Definition at line 124 of file error.c.

References mute_cutoff.

Referenced by init_verb_mute(), and man_dispatch_command().

◆ set_suppress_timestamps()

void set_suppress_timestamps ( bool  suppressed)

Definition at line 150 of file error.c.

References suppress_timestamps.

Referenced by add_option().

◆ strerror_win32()

const char* strerror_win32 ( DWORD  errnum,
struct gc_arena gc 
)

◆ x_check_status()

void x_check_status ( int  status,
const char *  description,
struct link_socket sock,
struct tuntap tt 
)

◆ x_msg()

void x_msg ( const unsigned int  flags,
const char *  format,
  ... 
)

Definition at line 214 of file error.c.

References x_msg_va().

◆ x_msg_va()

void x_msg_va ( const unsigned int  flags,
const char *  format,
va_list  arglist 
)

Variable Documentation

◆ x_cs_err_delay_ms

unsigned int x_cs_err_delay_ms

Definition at line 635 of file error.c.

Referenced by msg_test(), and x_check_status().

◆ x_cs_info_level

unsigned int x_cs_info_level

Definition at line 633 of file error.c.

Referenced by msg_test(), reset_check_status(), set_check_status(), and x_check_status().

◆ x_cs_verbose_level

unsigned int x_cs_verbose_level

Definition at line 634 of file error.c.

Referenced by msg_test(), reset_check_status(), set_check_status(), and x_check_status().

◆ x_debug_level

unsigned int x_debug_level

◆ x_msg_line_num

int x_msg_line_num

Definition at line 211 of file error.c.

Referenced by x_msg_va().

◆ x_msg_prefix

const char* x_msg_prefix

Definition at line 720 of file error.c.

Referenced by msg_get_prefix(), and set_check_status_error_delay().

◆ x_msg_virtual_output

const struct virtual_output* x_msg_virtual_output

Definition at line 726 of file error.c.

Referenced by msg_get_prefix(), and msg_get_virtual_output().