diff options
author | Selva Nair | 2016-06-07 00:44:20 -0400 |
---|---|---|
committer | Gert Doering | 2016-06-07 22:54:38 +0200 |
commit | 63b3e000c9141f4ca03a374354da26334257bc18 (patch) | |
tree | 8bbb323b759bd362ed28b665a86a424f5a9d06c7 /src/openvpn/sig.c | |
parent | 7f74c27e105a365d278181d00708c55a299398a0 (diff) | |
download | openvpn-63b3e000c9141f4ca03a374354da26334257bc18.zip openvpn-63b3e000c9141f4ca03a374354da26334257bc18.tar.gz |
Ignore SIGUSR1/SIGHUP during exit notification
This allows exit notification to complete and finally trigger SIGTERM.
The current practice of allowing a restart in this state clears
the exit notification timer data and thus loses the SIGTERM.
Trac #687
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1465274660-11009-2-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11814
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/sig.c')
-rw-r--r-- | src/openvpn/sig.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c index f903fc0..718b786 100644 --- a/src/openvpn/sig.c +++ b/src/openvpn/sig.c @@ -376,12 +376,35 @@ process_sigterm (struct context *c) return ret; } +/** + * If a restart signal is received during exit-notification, reset the + * signal and return true. + */ +static bool +ignore_restart_signals (struct context *c) +{ + bool ret = false; +#ifdef ENABLE_OCC + if ( (c->sig->signal_received == SIGUSR1 || c->sig->signal_received == SIGHUP) && + event_timeout_defined(&c->c2.explicit_exit_notification_interval) ) + { + msg (M_INFO, "Ignoring %s received during exit notification", + signal_name(c->sig->signal_received, true)); + signal_reset (c->sig); + ret = true; + } +#endif + return ret; +} + bool process_signal (struct context *c) { bool ret = true; - if (c->sig->signal_received == SIGTERM || c->sig->signal_received == SIGINT) + if (ignore_restart_signals (c)) + ret = false; + else if (c->sig->signal_received == SIGTERM || c->sig->signal_received == SIGINT) { ret = process_sigterm (c); } |