]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Add master_detach option
authorPaul Mackerras <paulus@samba.org>
Sat, 2 Mar 2013 09:25:28 +0000 (20:25 +1100)
committerPaul Mackerras <paulus@samba.org>
Sat, 2 Mar 2013 09:25:28 +0000 (20:25 +1100)
This adds a new option, master_detach, to allow pppd to detach from
the controlling terminal when it is the multilink bundle master but
its own link has terminated, even if the nodetach option has been
given.

Requested-by: Stephen Marron <sfm@boxfusion.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd/auth.c
pppd/options.c
pppd/pppd.8
pppd/pppd.h

index 7b269b805b2b7eb06ec9792c7e24c222a6c4b3c8..2f81283aceb9d4df9f302ae19e1815c5c36b7bf9 100644 (file)
@@ -665,9 +665,11 @@ link_terminated(unit)
        (*the_channel->cleanup)();
 
     if (doing_multilink && multilink_master) {
-       if (!bundle_terminating)
+       if (!bundle_terminating) {
            new_phase(PHASE_MASTER);
-       else
+           if (master_detach && !detached)
+               detach();
+       } else
            mp_bundle_terminated();
     } else
        new_phase(PHASE_DEAD);
index 008b48217eeef2f2c3a722566c3cfea1ad78d5d1..45fa742cd9ce9d095490ebc68fa199023f8da8cc 100644 (file)
@@ -96,6 +96,7 @@ int   default_device = 1;     /* Using /dev/tty or equivalent */
 char   devnam[MAXPATHLEN];     /* Device name */
 bool   nodetach = 0;           /* Don't detach from controlling tty */
 bool   updetach = 0;           /* Detach once link is up */
+bool   master_detach;          /* Detach when we're (only) multilink master */
 int    maxconnect = 0;         /* Maximum connect time */
 char   user[MAXNAMELEN];       /* Username for PAP */
 char   passwd[MAXSECRETLEN];   /* Password for PAP */
@@ -210,6 +211,9 @@ option_t general_options[] = {
       "Detach from controlling tty once link is up",
       OPT_PRIOSUB | OPT_A2CLR | 1, &nodetach },
 
+    { "master_detach", o_bool, &master_detach,
+      "Detach when we're multilink master but have no link", 1 },
+
     { "holdoff", o_int, &holdoff,
       "Set time in seconds before retrying connection",
       OPT_PRIO, &holdoff_specified },
index 77be9801d1024f1f1468970ce24ff15440f2441a..f7954fa74e0f811c7331d0b2efa4a02a569413e0 100644 (file)
@@ -624,6 +624,14 @@ must have an entry in the /etc/ppp/pap\-secrets file as well as the
 system password database to be allowed access.  See also the
 \fBenable\-session\fR option.
 .TP
+.B master_detach
+If multilink is enabled and this pppd process is the multilink bundle
+master, and the link controlled by this pppd process terminates, this
+pppd process continues to run in order to maintain the bundle.  If the
+\fBmaster_detach\fR option has been given, pppd will detach from its
+controlling terminal in this situation, even if the \fBnodetach\fR
+option has been given.
+.TP
 .B maxconnect \fIn
 Terminate the connection when it has been available for network
 traffic for \fIn\fR seconds (i.e. \fIn\fR seconds after the first
index 1f208894f77bf38a9e7ad20bfb64c919271ae767..47e4d9ad40c36e692b97be97d268116fb8b0ef46 100644 (file)
@@ -285,6 +285,7 @@ extern u_int32_t netmask;   /* IP netmask to set on interface */
 extern bool    lockflag;       /* Create lock file to lock the serial dev */
 extern bool    nodetach;       /* Don't detach from controlling tty */
 extern bool    updetach;       /* Detach from controlling tty when link up */
+extern bool    master_detach;  /* Detach when multilink master without link */
 extern char    *initializer;   /* Script to initialize physical link */
 extern char    *connect_script; /* Script to establish physical link */
 extern char    *disconnect_script; /* Script to disestablish physical link */