mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-05 03:39:02 +00:00
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).
This commit is contained in:
parent
26f13ad079
commit
ac685e314f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47689
@ -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.54 1999/05/27 08:42:15 brian Exp $
|
||||
* $Id: bundle.c,v 1.55 1999/05/31 23:57:32 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);
|
||||
|
@ -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.21 1999/01/28 01:56:30 brian Exp $
|
||||
* $Id: bundle.h,v 1.22 1999/05/31 23:57:33 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
|
||||
|
||||
|
@ -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.194 1999/05/15 02:24:16 brian Exp $
|
||||
* $Id: command.c,v 1.195 1999/05/31 23:57:35 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/15 02:24:16 $";
|
||||
const char VersionDate[] = "$Date: 1999/05/31 23:57:35 $";
|
||||
|
||||
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",
|
||||
|
@ -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.14 1999/05/24 16:39:12 brian Exp $
|
||||
* $Id: physical.c,v 1.15 1999/06/01 19:08:58 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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.169 1999/05/16 13:39:03 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.170 1999/06/01 08:46:53 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.nr XX \w'\fC00'
|
||||
.Os FreeBSD
|
||||
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.169 1999/05/16 13:39:03 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.170 1999/06/01 08:46:53 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.nr XX \w'\fC00'
|
||||
.Os FreeBSD
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user