aboutsummaryrefslogtreecommitdiff
path: root/manage.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2007-10-22 19:12:54 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2007-10-22 19:12:54 +0000
commit1184b82454776eb075d01c308870697a1668612d (patch)
treebf1a83537d477cee76d5c27e997f2372a8503056 /manage.c
parentAdd "forget-passwords" command to the management interface (Alon Bar-Lev). (diff)
downloadopenvpn-1184b82454776eb075d01c308870697a1668612d.tar.xz
Added --management-signal option to signal SIGUSR1 when the management
interface disconnects (Alon Bar-Lev). git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2413 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-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);