diff options
author | brian <brian@cvs.openbsd.org> | 1999-06-02 00:46:56 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1999-06-02 00:46:56 +0000 |
commit | 6e4a2d45c5b91a75b1ecedd9e8df21e1f1af2997 (patch) | |
tree | 8d77f8c2953d125818f65882e145da234ad4508b /usr.sbin/ppp | |
parent | 83226c98c22fe6057e7b537a7ff0b34d8e4670f1 (diff) |
Introduce the ``keep-session'' option. Refer to the man
page for details. This allows MP over non-tty devices where
the original ppp process must not exit (such as sshd-spawned
ppp sessions).
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/ppp/bundle.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/bundle.h | 17 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/physical.c | 9 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ppp.8 | 38 |
5 files changed, 62 insertions, 17 deletions
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index 4fddb9cbc97..b7a19a598f3 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.c,v 1.18 1999/05/31 23:57:35 brian Exp $ + * $Id: bundle.c,v 1.19 1999/06/02 00:46:55 brian Exp $ */ #include <sys/param.h> @@ -1220,6 +1220,8 @@ bundle_ShowStatus(struct cmdargs const *arg) optval(arg->bundle, OPT_SROUTES)); prompt_Printf(arg->prompt, " ID check: %s\n", optval(arg->bundle, OPT_IDCHECK)); + prompt_Printf(arg->prompt, " Keep-Session: %s\n", + optval(arg->bundle, OPT_KEEPSESSION)); prompt_Printf(arg->prompt, " Loopback: %s\n", optval(arg->bundle, OPT_LOOPBACK)); prompt_Printf(arg->prompt, " PasswdAuth: %s\n", @@ -1520,7 +1522,8 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) /* We must get the ACK before closing the descriptor ! */ read(s, &ack, 1); - newsid = tcgetpgrp(link_fd) == getpgrp(); + newsid = Enabled(dl->bundle, OPT_KEEPSESSION) || + tcgetpgrp(link_fd) == getpgrp(); close(link_fd); if (newsid) bundle_setsid(dl->bundle, 1); diff --git a/usr.sbin/ppp/ppp/bundle.h b/usr.sbin/ppp/ppp/bundle.h index 936dd8c211d..cb1ae3cbedf 100644 --- a/usr.sbin/ppp/ppp/bundle.h +++ b/usr.sbin/ppp/ppp/bundle.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.h,v 1.5 1999/05/31 23:57:35 brian Exp $ + * $Id: bundle.h,v 1.6 1999/06/02 00:46:55 brian Exp $ */ #define PHASE_DEAD 0 /* Link is dead */ @@ -35,13 +35,14 @@ /* cfg.opt bit settings */ #define OPT_IDCHECK 0x0001 #define OPT_IFACEALIAS 0x0002 -#define OPT_LOOPBACK 0x0004 -#define OPT_PASSWDAUTH 0x0008 -#define OPT_PROXY 0x0010 -#define OPT_PROXYALL 0x0020 -#define OPT_SROUTES 0x0040 -#define OPT_THROUGHPUT 0x0080 -#define OPT_UTMP 0x0100 +#define OPT_KEEPSESSION 0x0004 +#define OPT_LOOPBACK 0x0008 +#define OPT_PASSWDAUTH 0x0010 +#define OPT_PROXY 0x0020 +#define OPT_PROXYALL 0x0040 +#define OPT_SROUTES 0x0080 +#define OPT_THROUGHPUT 0x0100 +#define OPT_UTMP 0x0200 #define MAX_ENDDISC_CLASS 5 diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 0671fccb4a5..03fa67ca7b4 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.22 1999/05/31 23:57:36 brian Exp $ + * $Id: command.c,v 1.23 1999/06/02 00:46:55 brian Exp $ * */ #include <sys/param.h> @@ -143,7 +143,7 @@ #define NEG_DNS 52 const char Version[] = "2.21"; -const char VersionDate[] = "$Date: 1999/05/31 23:57:36 $"; +const char VersionDate[] = "$Date: 1999/06/02 00:46:55 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -2271,6 +2271,8 @@ static struct cmdtab const NegotiateCommands[] = { {"iface-alias", NULL, IfaceAliasOptSet, LOCAL_AUTH, "retain interface addresses", "disable|enable", (const void *)OPT_IFACEALIAS}, + {"keep-session", NULL, OptSet, LOCAL_AUTH, "Retain device session leader", + "disable|enable", (const void *)OPT_KEEPSESSION}, {"loopback", NULL, OptSet, LOCAL_AUTH, "Loop packets for local iface", "disable|enable", (const void *)OPT_LOOPBACK}, {"passwdauth", NULL, OptSet, LOCAL_AUTH, "Use passwd file", @@ -2286,7 +2288,7 @@ static struct cmdtab const NegotiateCommands[] = { {"utmp", NULL, OptSet, LOCAL_AUTH, "Log connections in utmp", "disable|enable", (const void *)OPT_UTMP}, -#define OPT_MAX 9 /* accept/deny allowed below and not above */ +#define OPT_MAX 10 /* accept/deny allowed below and not above */ {"acfcomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX, "Address & Control field compression", "accept|deny|disable|enable", diff --git a/usr.sbin/ppp/ppp/physical.c b/usr.sbin/ppp/ppp/physical.c index b971808760d..24fd08eafc8 100644 --- a/usr.sbin/ppp/ppp/physical.c +++ b/usr.sbin/ppp/ppp/physical.c @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: physical.c,v 1.11 1999/06/01 19:08:52 brian Exp $ + * $Id: physical.c,v 1.12 1999/06/02 00:46:55 brian Exp $ * */ @@ -595,8 +595,11 @@ physical2iov(struct physical *p, struct iovec *iov, int *niov, int maxiov, p->handler = (struct device *)(long)p->handler->type; } - if (tcgetpgrp(p->fd) == getpgrp()) + if (Enabled(p->dl->bundle, OPT_KEEPSESSION) || + tcgetpgrp(p->fd) == getpgrp()) p->session_owner = getpid(); /* So I'll eventually get HUP'd */ + else + p->session_owner = (pid_t)-1; timer_Stop(&p->link.throughput.Timer); physical_ChangedPid(p, newpid); } @@ -618,7 +621,7 @@ physical2iov(struct physical *p, struct iovec *iov, int *niov, int maxiov, void physical_ChangedPid(struct physical *p, pid_t newpid) { - if (p->fd >= 0 && p->type != PHYS_DIRECT) { + if (p->fd >= 0 && *p->name.full == '/' && p->type != PHYS_DIRECT) { int res; if ((res = ID0uu_lock_txfr(p->name.base, newpid)) != UU_LOCK_OK) diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8 index 20cde5520d2..9d2a67050b5 100644 --- a/usr.sbin/ppp/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.44 1999/06/01 08:46:43 brian Exp $ +.\" $Id: ppp.8,v 1.45 1999/06/02 00:46:55 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os @@ -2473,6 +2473,41 @@ field, reporting the fact at the respective log level. If is disabled, .Nm will ignore the identifier field. +.It keep-session +Default: Disabled. When +.Nm +runs as a Multi-link server, a different +.Nm +instance initially receives each connection. After determining that +the link belongs to an already existing bundle (controlled by another +.Nm +invocation), +.Nm +will transfer the link to that process. +.Pp +If the link is a tty device or if this option is enabled, +.Nm +will not exit, but will change its process name to +.Dq session owner +and wait for the controlling +.Nm +to finish with the link and deliver a signal back to the idle process. +This prevents the confusion that results from +.Nm ppp Ns No 's +parent considering the link resource available again. +.Pp +For tty devices that have entries in +.Pa /etc/ttys , +this is necessary to prevent another +.Xr getty 8 +from being started, and for program links such as +.Xr sshd 8 , +it prevents +.Xr sshd 8 +from exiting due to the death of its child. As +.Nm +cannot determine its parents requirements (except for the tty case), this +option must be enabled manually depending on the circumstances. .It loopback Default: Enabled. When .Ar loopback @@ -4535,6 +4570,7 @@ This socket is used to pass links between different instances of .Xr pppctl 8 , .Xr pppd 8 , .Xr route 8 , +.Xr sshd 8 , .Xr syslogd 8 , .Xr traceroute 8 , .Xr vipw 8 |