0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-19 19:42:30 +02:00

Avoid SIGUSR1 to SIGHUP remapping when the configuration is read from stdin

If the configuration is read from stdin, we cannot reread the configuration
as stdin provides the configuration only once. So whenever we hit the
"close_context usr1 to hup" logic, the OpenVPN process will fail as tries
to restart with an empty configuration.

While OpenVPN tries to block  USR1 from normal unix signal, I have observed
cases in my app which sends USR1 from management interface where the
CC_HARD_USR1_TO_HUP logic is trigger and breaking the OpenVPN process.

Change-Id: Icfc179490d6821e22d14817941fb0bad667c713f
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20240719131016.75042-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28941.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Arne Schwabe 2024-07-19 15:10:16 +02:00 committed by Gert Doering
parent 14d2db6cd4
commit b620025b95

View File

@ -32,6 +32,7 @@
#include "multi.h"
#include "win32.h"
#include "platform.h"
#include "string.h"
#include "memdbg.h"
@ -60,9 +61,10 @@ tunnel_point_to_point(struct context *c)
/* set point-to-point mode */
c->mode = CM_P2P;
/* initialize tunnel instance */
init_instance_handle_signals(c, c->es, CC_HARD_USR1_TO_HUP);
/* initialize tunnel instance, avoid SIGHUP when config is stdin since
* re-reading the config from stdin will not work */
bool stdin_config = c->options.config && (strcmp(c->options.config, "stdin") == 0);
init_instance_handle_signals(c, c->es, stdin_config ? 0 : CC_HARD_USR1_TO_HUP);
if (IS_SIG(c))
{
return;