aboutsummaryrefslogtreecommitdiff
path: root/manage.c
diff options
context:
space:
mode:
Diffstat (limited to 'manage.c')
-rw-r--r--manage.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/manage.c b/manage.c
index 7323dd6..b6f8bcf 100644
--- a/manage.c
+++ b/manage.c
@@ -1080,6 +1080,15 @@ man_reset_client_socket (struct management *man, const bool exiting)
}
if (!exiting)
{
+ if (man->settings.signal_on_disconnect) {
+ int mysig = man_mod_signal (man, SIGUSR1);
+ if (mysig >= 0)
+ {
+ msg (D_MANAGEMENT, "MANAGEMENT: Triggering management signal");
+ throw_signal_soft (mysig, "management-disconnect");
+ }
+ }
+
if (man->settings.connect_as_client)
{
msg (D_MANAGEMENT, "MANAGEMENT: Triggering management exit");
@@ -1323,6 +1332,7 @@ man_settings_init (struct man_settings *ms,
const int echo_buffer_size,
const int state_buffer_size,
const bool hold,
+ const bool signal_on_disconnect,
const bool connect_as_client,
const char *write_peer_info_file,
const int remap_sigusr1)
@@ -1355,6 +1365,12 @@ man_settings_init (struct man_settings *ms,
ms->hold = hold;
/*
+ * Should OpenVPN be signaled if management
+ * disconnects?
+ */
+ ms->signal_on_disconnect = signal_on_disconnect;
+
+ /*
* Should OpenVPN connect to management interface as a client
* rather than a server?
*/
@@ -1496,6 +1512,7 @@ management_open (struct management *man,
const int echo_buffer_size,
const int state_buffer_size,
const bool hold,
+ const bool signal_on_disconnect,
const bool connect_as_client,
const char *write_peer_info_file,
const int remap_sigusr1)
@@ -1516,6 +1533,7 @@ management_open (struct management *man,
echo_buffer_size,
state_buffer_size,
hold,
+ signal_on_disconnect,
connect_as_client,
write_peer_info_file,
remap_sigusr1);