26 #elif defined(_MSC_VER) 55 {
SIGINT,
"SIGINT",
"sigint"},
56 {
SIGTERM,
"SIGTERM",
"sigterm" },
57 {
SIGHUP,
"SIGHUP",
"sighup" },
58 {
SIGUSR1,
"SIGUSR1",
"sigusr1" },
59 {
SIGUSR2,
"SIGUSR2",
"sigusr2" }
66 for (i = 0; i < (int)
SIZE(signames); ++i)
68 if (!strcmp(signame, signames[i].
upper))
70 return signames[i].
value;
80 for (i = 0; i < (int)
SIZE(signames); ++i)
82 if (sig == signames[i].
value)
84 return upper ? signames[i].
upper : signames[i].
lower;
135 const char *t = (title ? title :
"process");
136 const char *hs = NULL;
148 hs =
"connection failed(soft)";
159 msg(msglevel,
"%s[%s,%s] received, %s exiting",
165 msg(msglevel,
"%s[%s,%s] received, %s restarting",
170 msg(msglevel,
"Unknown signal %d [%s,%s] received by %s", si->
signal_received, hs, type, t);
176 msg(msglevel,
"Unknown signal received");
186 #ifdef ENABLE_MANAGEMENT 221 signal_handler(
const int signum)
224 signal(signum, signal_handler);
233 #define SM_PRE_INIT 1 234 #define SM_POST_INIT 2 235 static int signal_mode;
243 signal_mode = SM_PRE_INIT;
244 signal(
SIGINT, signal_handler);
245 signal(
SIGTERM, signal_handler);
249 signal(SIGPIPE, SIG_IGN);
259 signal_mode = SM_POST_INIT;
260 signal(
SIGINT, signal_handler);
261 signal(
SIGTERM, signal_handler);
262 signal(
SIGHUP, signal_handler);
263 signal(
SIGUSR1, signal_handler);
264 signal(
SIGUSR2, signal_handler);
265 signal(SIGPIPE, SIG_IGN);
275 if (signal_mode == SM_PRE_INIT)
279 else if (signal_mode == SM_POST_INIT)
306 if (c->
c2.comp_context)
308 comp_print_stats(c->
c2.comp_context, so);
311 #ifdef PACKET_TRUNCATION_CHECK 339 msg(
M_INFO,
"SIGTERM received, sending exit notification to peer");
421 msg(
M_INFO,
"Ignoring %s received during exit notification",
428 msg(
M_INFO,
"Converting soft %s received during exit notification to SIGTERM",
struct signal_info siginfo_static
void print_signal(const struct signal_info *si, const char *title, int msglevel)
counter_type tun_read_bytes
const char * signal_description(const int signum, const char *sigtext)
static void halt_non_edge_triggered_signals(void)
struct options options
Options loaded from command line or configuration file.
counter_type link_write_bytes
Contains all state information for one tunnel.
void throw_signal_soft(const int signum, const char *signal_text)
void remap_signal(struct context *c)
static void gc_free(struct gc_arena *a)
static bool process_sigterm(struct context *c)
static void event_timeout_clear(struct event_timeout *et)
struct signal_info * sig
Internal error signaling object.
void post_init_signal_catch(void)
struct tuntap * tuntap
Tun/tap virtual network interface.
int explicit_exit_notification
const char * tap_win_getinfo(const struct tuntap *tt, struct gc_arena *gc)
static bool tuntap_defined(const struct tuntap *tt)
void status_printf(struct status_output *so, const char *format,...)
void restore_signal_state(void)
void status_flush(struct status_output *so)
struct status_output * status_open(const char *filename, const int refresh_freq, const int msglevel, const struct virtual_output *vout, const unsigned int flags)
time_t explicit_exit_notification_time_wait
bool status_close(struct status_output *so)
struct context_1 c1
Level 1 context.
void pre_init_signal_catch(void)
const char * signal_name(const int sig, const bool upper)
static void process_sigusr2(const struct context *c)
counter_type tun_write_bytes
bool event_timeout_trigger(struct event_timeout *et, struct timeval *tv, const int et_const_retry)
counter_type link_read_bytes
static struct gc_arena gc_new(void)
static void signal_reset(struct signal_info *si)
void process_explicit_exit_notification_timer_wakeup(struct context *c)
static bool event_timeout_defined(const struct event_timeout *et)
const char * time_string(time_t t, int usec, bool show_usec, struct gc_arena *gc)
static bool ignore_restart_signals(struct context *c)
If a restart signal is received during exit-notification, reset the signal and return true...
void reset_coarse_timers(struct context *c)
struct connection_entry ce
struct context_2 c2
Level 2 context.
void print_status(const struct context *c, struct status_output *so)
static const struct signame signames[]
bool process_signal(struct context *c)
void signal_restart_status(const struct signal_info *si)
#define SIG_SOURCE_CONNECTION_FAILED
#define OPENVPN_STATE_RECONNECTING
int parse_signal(const char *signame)
volatile int signal_received
void register_signal(struct context *c, int sig, const char *text)
struct event_timeout explicit_exit_notification_interval
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)
#define OPENVPN_STATE_EXITING
void throw_signal(const int signum)
Garbage collection arena used to keep track of dynamically allocated memory.
static void process_explicit_exit_notification_init(struct context *c)
void status_reset(struct status_output *so)
static void event_timeout_init(struct event_timeout *et, interval_t n, const time_t local_now)
counter_type link_read_bytes_auth