summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/tty.c
Commit message (Collapse)AuthorAgeFilesLines
* Handle PPPoPTY correctly.brian1999-12-131-2/+2
|
* Change ``set cd'' so that its default value is device specific. Thebrian1999-11-261-7/+13
| | | | | default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN) devices and 5 seconds for ethernet (PPPoE) devices.
* Rewrite the link descriptor transfer code in MP mode.brian1999-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Support PPPoEbrian1999-11-061-2/+3
| | | | | Help (lots) from: julian, archie Facilities from: ahebert@pubnix.net
* Redefine CRTS_IFLOW and CCTS_OFLOW on the mac.brian1999-10-151-0/+7
| | | | Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* Support ``set cd off'' to tell ppp not to even look for carrier on thebrian1999-09-261-3/+4
| | | | device.
* Back out the bogus #ifdef __NetBSD__ #include <signal.h> lines.brian1999-09-211-3/+0
| | | | | | | The original report was due to a mis-installation of the NetBS header files :-/ Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* NetBSD has moved ``extern int errno;'' to signal.h :-/brian1999-09-201-0/+3
| | | | Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Back out the last patch. I'm too tired to apply patches.brian1999-08-091-6/+2
|
* Remove CLOCAL when we're not in -dedicated mode.brian1999-08-091-3/+7
| | | | | PR: 13046 Submitted by: Vsevolod Lobko <seva@alex-ua.com>
* Add ISDN support via isdnd & i4b. This requires versionbrian1999-08-061-76/+63
| | | | | | | | | | | | | | | | | | | | | | | | | 0.81.1 of the i4b code - namely support of the I4B_VR_REQ ioctl via the i4brbchX device. Ppp controls the phone number, but idle timers and SYNC/RAW decisions are still made by isdnd (in isdnd.rc). This involves a new datalink state machine phase. The ``wait for carrier'' phase happens after dialing but before logging in. The whole dial state should really be abstracted so that each device type can deal with it in its own way (thinking about PPPoE) - but that'll have to wait. The ``set cd'' symantics remain the same for tty devices, but we now delay until we either get CD or timeout waiting (at which time we drop the link if we require CD). For i4b devices we always insist on carrier. Thanks to hm@ for his help, and especially for pointing out that I *don't* need to re-implement isdnd (that was a huge waste of time !) :-]
* Correct the way ppp transfers links on the server side in MPbrian1999-06-051-5/+26
| | | | | | | | | mode by padding out the ``struct device'' to the maximum device size. Bump the ppp version number to indicate the transfer format change. This should make MP over tty and udp devices functional again.
* Call tty_Offline() from tty_Cooked() and tty_Free(), just inbrian1999-05-271-1/+4
| | | | | case ppp is abending and hasn't called physical_Offline() already.
* Correct the ``ignoring sync/async'' warnings so that they showbrian1999-05-241-7/+4
| | | | | | up with the correct device type. Reassign the correct tcpdevice or execdevice after transfering a link in MP server mode.
* Move the tty locking stuff back out to physical.c sobrian1999-05-181-109/+56
| | | | | | that we lock the device *before* we open it. We still open the device only once - and then ask all our handlers if they know how to handle it.
* Initialise ttydevice::Timerbrian1999-05-161-1/+2
|
* Initialise the struct device part of struct ttydevice.brian1999-05-131-68/+69
|
* Fix a bum pointer dereference and make some variablebrian1999-05-131-46/+39
| | | | | names more consistent. Stack trace supplied by: Joe Clarke <jclarke@cisco.com>
* Allow ``host:port/udp'' devices and support ``host:port/tcp'' asbrian1999-05-121-92/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | being the same as the previous (still supported) ``host:port'' syntax for tcp socket devices. A udp device uses synchronous ppp rather than async, and avoids the double-retransmit overhead that comes with ppp over tcp (it's usually a bad idea to transport IP over a reliable transport that itself is using an unreliable transport). PPP over UDP provides througput of ** 1.5Mb per second ** with all compression disabled, maxing out a PPro/200 when running ppp twice, back-to-back. This proves that PPPoE is plausable in userland.... This change adds a few more handler functions to struct device and allows derivations of struct device (which may contain their own data etc) to pass themselves through the unix domain socket for MP. ** At last **, struct physical has lost all the tty crud ! iov2physical() is now smart enough to restore the correct stack of layers so that MP servers will work again. The version number has bumped as our MP link transfer contents have changed (they now may contain a `struct device'). Don't extract the protocol twice in MP mode (resulting in protocol rejects for every MP packet). This was broken with my original layering changes. Add ``Physical'' and ``Sync'' log levels for logging the relevent raw packets and add protocol-tracking LogDEBUG stuff in various LayerPush & LayerPull functions. Assign our physical device name for incoming tcp connections by calling getpeername(). Assign our physical device name for incoming udp connections from the address retrieved by the first recvfrom().
* o Redesign the layering mechanism and make the aliasing code part ofbrian1999-05-081-0/+446
the layering. We now ``stack'' layers as soon as we open the device (when we figure out what we're dealing with). A static set of `dispatch' routines are also declared for dealing with incoming packets after they've been `pulled' up through the stacked layers. Physical devices are now assigned handlers based on the device type when they're opened. For the moment there are three device types; ttys, execs and tcps. o Increment version number to 2.2 o Make an entry in [uw]tmp for non-tty -direct invocations (after pap/chap authentication). o Make throughput counters quad_t's o Account for the absolute number of mbuf malloc()s and free()s in ``show mem''. o ``show modem'' becomes ``show physical''.
OpenPOWER on IntegriCloud