0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

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>
This commit is contained in:
Selva Nair 2016-06-07 00:44:20 -04:00 committed by Gert Doering
parent 7f74c27e10
commit 63b3e000c9

View File

@ -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);
}