Hi,

On Wed, Aug 08, 2012 at 12:45:13AM +0200, Arne Schwabe wrote:
> @@ -2478,7 +2478,8 @@ command.
>  .B \-\-management-signal
>  Send SIGUSR1 signal to OpenVPN if management session disconnects.
>  This is useful when you wish to disconnect an OpenVPN session on
> -user logoff.
> +user logoff. When used in conjuction with --management-client SIGTERM
> +will be sent.
>  .\"*********************************************************

OK, for the record and the archive :-) - I've now tried to follow the
twisted maze of manage.c to understand why one or the other signal
is sent.

This is happening inside man_reset_client_socket(), in this bit of code:

  if (!exiting)
    {
...
      if (man->settings.flags & MF_SIGNAL) {
          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.flags & MF_CONNECT_AS_CLIENT)
        {
          msg (D_MANAGEMENT, "MANAGEMENT: Triggering management exit");
          throw_signal_soft (SIGTERM, "management-exit");
        }
      else
        man_listen (man);
    }

MF_CONNECT_AS_CLIENT is set by options.c if --management-client is
used, MF_SIGNAL is set by options.c if --management-signal is used - but
note that the "if (... MF_SIGNAL)" clause doesn't apply to the SIGTERM
signalling.


So, if I read this right

 - SIGTERM will *always* be sent upon management-disconnect if
   --management-client has been used, even if --management-signal
   is not set

 - SIGUSR1 will be sent upon disconnect *if* requested by --management-signal
   (subject to remapping, but not automatically remapped)

if that analysis is correct, I'd re-word the proposed new text in the manpage
somewhat.  Suggested wording:

 .B \-\-management-signal
 Send SIGUSR1 signal to OpenVPN if management session disconnects
 (subject to remapping by \-\-remap-usr1).
 This is useful when you wish to disconnect an OpenVPN session on
 user logoff.  If \-\-management-client is used, a SIGTERM signal
 will always be sent on disconnect, even if \-\-management-signal is 
 not set.
 .\"*********************************************************

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: pgpu7QcjF2MdP.pgp
Description: PGP signature

Reply via email to