From owner-freebsd-current Sat May 23 16:15:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA20249 for freebsd-current-outgoing; Sat, 23 May 1998 16:15:23 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA20236 for ; Sat, 23 May 1998 16:15:17 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from gate.lan.awfulhak.org (localhost [127.0.0.1]) by awfulhak.org (8.8.8/8.8.8) with ESMTP id XAA26943; Sat, 23 May 1998 23:53:14 +0100 (BST) (envelope-from brian@gate.lan.awfulhak.org) Message-Id: <199805232253.XAA26943@awfulhak.org> X-Mailer: exmh version 2.0.1 12/23/97 To: Bruce Evans cc: brian@Awfulhak.org, archie@whistle.com, freebsd-current@FreeBSD.ORG, julian@whistle.com Subject: Re: **HEADS UP** user-ppp has changed ! In-reply-to: Your message of "Sun, 24 May 1998 03:54:09 +1000." <199805231754.DAA02639@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 23 May 1998 23:53:13 +0100 From: Brian Somers Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > >> Access to a controlling terminal is revoked when its controlling process > >> goes away. See kern_exit.c. > > > >Is there any way of avoiding this ? Perhaps relinquishing terminal > >control up front, *then* passing the descriptor ? > > Releasing a controlling terminal earlier just gives a dead descriptor > earlier. Session leaders can switch the controlling tty (hopefully > only when switching is secure). > > >The only other alternative is to keep a `/bin/cat' running - in which > >case I may as well do the `two /bin/cat' approach.... that way they > >get a SIGPIPE when something goes wrong and everything dies nicely. > > Why would cat be the controlling process? I'm not sure what the > controlling process is here. If it's a login shell, then don't kill > it. This is for dial-in access. The same remote ppp dials in to the local box twice. Ppp identifies that the guy on the other side is the same and ``joins'' the links into one ppp daemon. They both begin as the controlling tty of their respective links. Both try to create a local socket, and the race looser connect()s to it and passes the STDIN descriptor to the other using sendmsg() & SCM_RIGHTS. The other side can use the descriptor all the way up until the connect()ing process realises it's got nothing else to do and exits. As soon as the exit() happens, the device ttyclose() happens (in kern/tty.c) and the guy with the descriptor gets a descriptor exception from select() and falls on its face. The `cat' idea is to simply have the connect()ing side send some regular data about the link, and then fork() & exec() two instances of /bin/cat, attaching the socket descriptor and the tty to either end. The accept()ing side uses the socket descriptor as its modem device. I didn't like this idea 'cos I'm using up two processes too many :-( What'd be really nice is if there was some way of donating PGRP rights to the other side of a local socket - I'm not allowed to tcsetpgrp() 'cos the other ppp isn't part of my session. This would be similar to SCM_RIGHTS & SCM_CREDS, but would affect the tty in that the tty would zero its session pointer and change it's PGRP pointer to that of the receiver. It's probably trickier than that though :-/ Any comments ? > Bruce Thanks. -- Brian , , Don't _EVER_ lose your sense of humour.... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message