freebsd-dev/usr.sbin
Brian Somers 2cb305af77 Rewrite the link descriptor transfer code in MP mode.
Previously, ppp attempted to bind() to a local domain tcp socket
based on the peer authname & enddisc.  If it succeeded, it listen()ed
and became MP server.  If it failed, it connect()ed and became MP
client.  The server then select()ed on the descriptor, accept()ed
it and wrote its pid to it then read the link data & link file descriptor,
and finally sent an ack (``!'').  The client would read() the server
pid, transfer the link lock to that pid, send the link data & descriptor
and read the ack.  It would then close the descriptor and clean up.

There was a race between the bind() and listen() where someone could
attempt to connect() and fail.

This change removes the race.  Now ppp makes the RCVBUF big enough on a
socket descriptor and attempts to bind() to a local domain *udp* socket
(same name as before).  If it succeeds, it becomes MP server.  If it
fails, it sets the SNDBUF and connect()s, becoming MP client.  The server
select()s on the descriptor and recvmsg()s the message, insisting on at
least two descriptors (plus the link data).  It uses the second descriptor
to write() its pid then read()s an ack (``!'').  The client creates a
socketpair() and sendmsg()s the link data, link descriptor and one of
the socketpair descriptors.  It then read()s the server pid from the
other socketpair descriptor, transfers any locks and write()s an ack.

Now, there can be no race, and a connect() failure indicates a stale
socket file.

This also fixes MP ppp over ethernet, where the struct msghdr was being
misconstructed when transferring the control socket descriptor.

Also, if we fail to send the link, don't hang around in a ``session
owner'' state, just do the setsid() and fork() if it's required to
disown a tty.

UDP idea suggested by: Chris Bennet from Mindspring at FreeBSDCon
1999-11-25 02:47:04 +00:00
..
ac err -> errx for malloc failure 1999-10-12 19:27:11 +00:00
accton Add $FreeBSD$ lines to man pages that are missing them to make it 1999-08-28 23:23:38 +00:00
adduser $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
amd Update for 6.0.3s1 changes. 1999-11-05 12:34:00 +00:00
apm $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
apmconf $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
apmd Spelling fix. 1999-10-30 19:42:31 +00:00
arp Yet another align. 1999-09-20 09:10:46 +00:00
atm $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
bad144 unifdef -Uvax 1999-09-01 11:17:58 +00:00
boot0cfg $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
bootparamd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
btxld $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
cdcontrol Stop run() from dereferencing a NULL pointer when you enter a valid command 1999-11-18 23:04:38 +00:00
chkgrp add missing .El. 1999-10-17 15:46:58 +00:00
chown add .Sh DIAGNOSTICS 1999-10-17 15:50:19 +00:00
chroot $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ckdist $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
config Allow config to generate proper ioconf.c files when devices request DMA 1999-11-22 14:31:55 +00:00
cron $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
crunch $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ctm Remove comments left since mdoc.template time or just useless comments 1999-10-30 15:38:20 +00:00
dev_mkdb $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
diskpart $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
dpt Add $FreeBSD$ lines to man pages that are missing them to make it 1999-08-28 23:23:38 +00:00
edquota $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
elf2exe $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
fdcontrol Xref to warn(3) which is used instead of perror. 1999-10-17 15:52:26 +00:00
fdformat Correct use of .Nm. 1999-10-17 15:54:50 +00:00
fdwrite Use Pa for filenames. 1999-10-17 15:57:16 +00:00
i4b add MAINTAINER to userland part of i4b 1999-08-28 13:32:15 +00:00
inetd Put the listening socket into non-blocking mode before doing an 1999-11-17 03:32:05 +00:00
iostat $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ipfstat Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
ipftest Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
ipmon Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
ipnat Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
ipresend Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
ipsend Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
iptest Revive userland stuff for ipfilter. 1999-11-23 21:53:19 +00:00
IPXrouted $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
jail Add a version number field to the jail(2) argument so that future changes 1999-09-19 08:36:37 +00:00
kbdcontrol Do not suggest user to change /etc/defaults/rc.conf. 1999-11-18 16:09:40 +00:00
kbdmap $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
kernbb Correct spelling : ascii -> ASCII 1999-09-20 09:15:23 +00:00
keyadmin $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
keyserv $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
kgmon $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
kgzip $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
kvm_mkdb $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
lpr moved to koi2alt 1999-09-23 02:54:44 +00:00
lptcontrol $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
mailstats Build sendmail-8.9.1 makemap. 1998-08-04 15:25:32 +00:00
makemap Add snprintf.c to SRCS so that the function quad_to_string exists. The 1998-08-06 23:01:49 +00:00
manctl $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
memcontrol Remove an unnecessary cross-reference to ioctl(2) 1999-10-09 16:37:37 +00:00
mergemaster `mergemaster'' was repo-copied to `mergemaster.sh'' as it's a shell script. 1999-11-01 04:29:05 +00:00
mixer Spelling fix. 1999-10-30 19:36:42 +00:00
mount_nwfs Add reference to the share/examples/nwclient directory. 1999-11-14 13:48:31 +00:00
mount_portalfs mount* fixes from Martin Blapp <mb@imp.ch>: 1999-10-09 11:54:14 +00:00
mountd (1) Remove ISO support, it's dead in the kernel anyway. 1999-11-12 21:52:10 +00:00
moused "Plag and play" -> "Plug and Play" 1999-10-15 13:01:12 +00:00
mptable $FreeBSD$ tags moved to bottom of license aggmt. 1999-10-30 16:05:26 +00:00
mrouted Add $FreeBSD$ lines to man pages that are missing them to make it 1999-08-28 23:23:38 +00:00
mtest $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
mtree -Wall fixes. 1999-09-27 00:36:03 +00:00
named $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
named.reload $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
named.restart $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ndc $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
newsyslog $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
nfsd Give nfsd the ability to bind to specific IP addresses through the -h 1999-11-11 17:35:36 +00:00
ngctl Limit COPTS added by Makefile to just '-Wall'. 1999-10-28 20:17:13 +00:00
nghook Limit COPTS added by Makefile to just '-Wall'. 1999-10-28 20:17:13 +00:00
nologin $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
nslookup $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
nsupdate New bind8 program 1998-05-03 05:10:23 +00:00
pccard $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
pciconf $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
pcvt Restore -traditional compilation 1999-10-03 10:35:03 +00:00
periodic $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
pkg_install Make pkg_add -r package1 package2 package3 ... work correctly. 1999-11-18 23:32:43 +00:00
pnpinfo $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
portmap $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ppp Rewrite the link descriptor transfer code in MP mode. 1999-11-25 02:47:04 +00:00
pppctl NetBSD has changed the el_init() prototype 1999-09-20 07:22:22 +00:00
pppd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
pppstats $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
praliases Use sendmail-8.9.1 praliases 1998-08-04 15:26:57 +00:00
procctl $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
pstat struct mountlist and struct mount.mnt_list have no business being 1999-11-20 10:00:46 +00:00
pw Don't try updating the passwd file if no data has changed. This allows things 1999-10-26 15:07:20 +00:00
pwd_mkdb Allow empty UIDs if we are processing NIS records. I am not entirely 1999-11-22 12:42:38 +00:00
quot $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
quotaon $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rarpd Fix warning: return type of main' is not int' 1999-09-15 01:58:44 +00:00
repquota Description 1999-11-01 04:46:09 +00:00
rmt $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rndcontrol Update licence. 1999-09-04 07:38:49 +00:00
rpc.lockd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rpc.statd Undo previous change. 1999-10-05 14:40:38 +00:00
rpc.umntall Add rpc.umntall utility, to be used by startup and shutdown scripts 1999-11-21 08:06:00 +00:00
rpc.yppasswdd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rpc.ypupdated $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rpc.ypxfrd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rtprio $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
rwhod $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
sa $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
sade Clean up the loader.conf write-out code. 1999-11-24 09:45:36 +00:00
sendmail $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
sgsc $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
sicontrol Remove comments left since mdoc.template time or just useless comments 1999-10-30 15:38:20 +00:00
sliplogin $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
slstat $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
spkrtest $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
spray $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
stallion Fix warning: return type of main' is not int' 1999-09-15 01:58:44 +00:00
sysinstall Clean up the loader.conf write-out code. 1999-11-24 09:45:36 +00:00
syslogd $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
tcpdchk $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
tcpdmatch $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
tcpdump $Header$ -> $FreeBSD$ 1999-08-28 05:11:36 +00:00
timed $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
traceroute $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
trpt Remove comments left since mdoc.template time or just useless comments 1999-10-30 15:38:20 +00:00
tzsetup Re-add the libmytinfo/libncurses stuff - removing it breaks static 1999-09-01 23:36:21 +00:00
usbd Avoid null dereference on verbose output. 1999-11-24 19:18:57 +00:00
usbdevs Use releaseNo, not release. release is evil and should go away. 1999-11-23 01:16:10 +00:00
vidcontrol Fix broken cross reference : kldload(1) -> kldload(8) 1999-10-30 14:25:55 +00:00
vipw Do not rely on malloc() to zero-fill allocated memory, since it is 1999-10-25 09:46:57 +00:00
vnconfig Bring documentation up to date, add a few more vnconfig examples. 1999-09-21 01:03:11 +00:00
watch ``tty'' is not required parameter 1999-10-30 14:52:24 +00:00
wicontrol $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
wlconfig Add $FreeBSD$ lines to man pages that are missing them to make it 1999-08-28 23:23:38 +00:00
wormcontrol Use the sys/wormio.h definitions of CDRIOCNEXTWRITEABLEADDR and 1999-10-01 14:12:46 +00:00
xntpd Fix spelling errors. 1999-11-07 01:24:47 +00:00
xten $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
yp_mkdb Fix stupid disorder in previous commit. This was my own error, not 1999-09-01 12:42:00 +00:00
ypbind $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
yppoll $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
yppush $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ypserv $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
ypset $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
zic $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Makefile rewire userland ipfilter programs 1999-11-23 21:57:29 +00:00
Makefile.inc