summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/datalink.c
Commit message (Collapse)AuthorAgeFilesLines
* Add ISDN support via isdnd & i4b. This requires versionbrian1999-08-061-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | 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 !) :-]
* o Obsolete the undocumented ``set weight'' command.brian1999-08-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | o If we're using RADIUS and the RADIUS mtu is less than our peers mru/mrru, reduce our mtu to this value for NetBSD too. o Make struct throughput's sample period dynamic and tweak the ppp version number to reflect the extra stuff being passed through the local domain socket as a result (MP mode). o Measure the current throughput based on the number of samples actually taken rather than on the full sample period. o Keep the throughput statisics persistent while being passed to another ppp invocation through the local domain socket. o When showing throughput statistics after the timer has stopped, use the stopped time for overall calculations, not the current time. Also show the stopped time and how long the current throughput has been sampled for. o Use time() consistently in throughput.c o Tighten up the ``show bundle'' output. o Introduce the ``set bandwidth'' command. o Rewrite the ``set autoload'' command. It now takes three arguments and works based on a rolling bundle throughput average compared against the theoretical bundle bandwidth over a given period (read: it's now functional).
* Don't use the ``next'' redial timer if we have no phone number at all.brian1999-06-181-1/+3
|
* Never bring a link back up after receiving a terminating signal,brian1999-06-101-2/+2
| | | | don't rely on already being in PHASE_DEAD.
* Allow ``host:port/udp'' devices and support ``host:port/tcp'' asbrian1999-05-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-19/+19
| | | | | | | | | | | | | | | | | | | | | 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''.
* When going from DATALINK_HANGUP directly tobrian1999-04-061-1/+5
| | | | | | DATALINK_OPENING, don't forget to change phase to ESTABLISH if we're currently TERMINATE'ing. Helped locate by: Chuck Robey <chuckr@mat.net>
* When we get an LCP TLU, go into PHASE_AUTHENTICATEbrian1999-04-051-2/+2
| | | | | | from any other phase besides PHASE_NETWORK, otherwise there's a chance that we end up sending auth packets and dropping the replies.
* Extend the ``set redial'' command to allow incrementalbrian1999-03-041-46/+97
| | | | redial timeouts.
* Allow control over the number of ConfigREQ & TermREQ attemptsbrian1999-02-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that are made in each of the FSMs (LCP, CCP & IPCP) and the number of REQs/Challenges for PAP/CHAP by accepting more arguments in the ``set {c,ip,l}cpretry'' and ``set {ch,p}apretry'' commands. Change the non-convergence thresholds to 3 times the number of configured REQ tries (rather than the previous fixed ``10''). We now notice repeated NAKs and REJs rather than just REQs. Don't suggest that CHAP 0x05 isn't supported when it's not configured. Fix some bugs that expose themselves with smaller numbers of retries: o Handle instantaneous disconnects (set device /dev/null) correctly by stopping all fsm timers in fsm2initial. o Don't forget to uu_unlock() devices that are files but are not ttys (set device /dev/zero). Fix a *HORRENDOUS* bug in RFC1661 (already fixed for an Open event in state ``Closed''): According to the state transition table, a RCR+ or RCR- received in the ``Stopped'' state are supposed to InitRestartCounter, SendConfigReq and SendConfig{Ack,Nak}. However, in ``Stopped'', we haven't yet done a TLS (or the last thing we did is a TLF). We must therefore do the TLS at this point ! This was never noticed before because LCP and CCP used not use LayerStart() for anything interesting, and IPCP tends to go into Stopped then get a Down because of an LCP RTR rather than getting a RCR again.
* When our dial timeout is ``random'', display its valuebrian1999-02-251-9/+14
| | | | | | | | | correctly by invoking the timer to get the value before displaying the message. Don't assume that a value of 0 is ``random'' in ``show datalink''. Make the random value between 1 and DIAL_TIMEOUT rather than between 0 and DIAL_TIMEOUT-1
* Fully support both NT and LANMan CHAP type 0x80 as bothbrian1999-02-181-10/+9
| | | | authenticator and authenticatee.
* Nuke any remaining auth timers when datalinks come back downbrian1999-02-171-9/+17
| | | | to DATALINK_LCP.
* When resending chap challenges, resend the same challengebrian1999-02-111-5/+21
| | | | | | | | | | | | | | | | | | | each time rather than making up a new one. Increase the authname/authkey max sizes to 100 characters. Allow ``authkey'' specifications beginning with ``!''. When a challenge is received, the text following the ``!'' is executed as a program (expanding stuff in the same way that ``sh'' and ``!bg'' do). The program is passed the peer name, peer challenge and local ``authname'' on standard input and is expected to output the name/key combination that should be used to build the CHAP response. This provides support for Secure ID cards (guess what I was given at work recently!) using CHAP. Examples will follow.
* Decouple pap & chap output routines from the correspondingbrian1999-02-061-25/+24
| | | | | | | | | | | | | | | | | | | | | | | input routines and take advantage of the new init/continue interface in libradius. This allows a timely response on other links in an MP setup while RADIUS requests are in progress as well as the ability to handle other data from the peer in parallel. It should also make the future addition of PAM support trivial. While I'm in there, validate pap & chap header IDs if ``idcheck'' is enabled (the default) for other FSM packet types. NOTE: This involved integrating the generation of chap challenges and the validation of chap responses (and commenting what's going on in those routines). I currently have no way of testing ppps ability to respond to M$Chap CHALLENGEs correctly, so if someone could do the honours, it'd be much appreciated (it *looks* ok!). Sponsored by: Internet Business Solutions Ltd., Switzerland
* Reimplement the previous fix (no response to PAP requests)brian1999-02-021-5/+3
| | | | | | at the authentication layer rather than at the PAP layer so that it also applies to CHAP (no response to CHAP challenges).
* If we receive no answer from the server when sending PAPbrian1999-02-011-3/+5
| | | | requests, give up (don't sit there indefinitely).
* Initial RADIUS support (using libradius). See the man page forbrian1999-01-281-2/+5
| | | | | | | | | | | | | | | | | | | details. Compiling with -DNORADIUS (the default for `release') removes support. TODO: The functionality in libradius::rad_send_request() needs to be supplied as a set of routines so that ppp doesn't have to wait indefinitely for the radius server(s). Instead, we need to get a descriptor back, select() on the descriptor, and ask libradius to service it when necessary. For now, ppp blocks SIGALRM while in rad_send_request(), so it misses PAP/CHAP retries & timeouts if they occur. Only PAP is functional. When CHAP is attempted, libradius complains that no User-Password has been specified... rfc2138 says that it *mustn't* be used for CHAP :-( Sponsored by: Internet Business Solutions Ltd., Switzerland
* Recurse when we've switched state via LoginDone(). If we'vebrian1999-01-201-2/+2
| | | | | got an open link, we want it to be select()d on - otherwise we get a freeze when ``openmode'' is passive.
* If we've configured CBCP *and* another not-so-importantbrian1999-01-121-5/+9
| | | | | | | CALLBACK protocol and end up agreeing CBCP, DTRT and go into CBCP phase rather than mistakenly terminating as if CBCP wasn't agreed. Problem reported by: Alexander Dubinin <alex@nstl.nnov.ru>
* Don't use the next phone number after the ``|'' if thebrian1999-01-081-1/+2
| | | | | | dial & login are successful. Submitted by: Toshiomi Moriki <Toshiomi.Moriki@ma1.seikyou.ne.jp> PR: 9382
* Fix a rather bad latency problem (uncovered by the recent timer commit).brian1998-12-151-2/+2
| | | | Problem reported by: Christopher Hall <hsw@acm.org>
* Boy, this was tricky to find:brian1998-12-101-1/+2
| | | | | | | Remove any dial timer that might be hanging around at datalink_Destroy() time. This timer may be left running after the link is closed (making sure it's not automatically opened again too soon).
* Explain what the ``*'' means for a CBCP phone numberbrian1998-10-171-3/+9
| | | | in ``show link''.
* Destroy any existing chat timeouts in datalink_ComeDown()brian1998-08-181-1/+2
| | | | | If we're told to close/down while in DIAL or LOGIN state, we don't want to keep our timeout running :-/
* When entering ``term'' mode, don't output any messages untilbrian1998-08-091-3/+11
| | | | | | | the device is successfully opened. If we fail to open it, mention the fact. Also go back into command mode as soon as the device is closed rather than waiting for the user to type something before noticing.
* o Support callback types NONE, E.164, AUTH and CBCP.brian1998-08-071-18/+167
| | | | | | | | | | | | | | (see the new ``set callback'' and ``set cbcp'' commands) o Add a ``cbcp'' log level and mbuf type. o Don't dump core when \T is given in ``set login'' or ``set hangup''. o Allow ``*'' and blanks as placeholders in ppp.secret and allow a fifth field for specifying auth/cbcp dialback parameters. o Remove a few extraneous #includes o Define the default number of REQs (restart counter) in defs.h rather than hardcoding ``5'' all over the place. o Fix a few man page inconsistencies.
* Only start checking carrier when the datalink state machinebrian1998-07-031-2/+4
| | | | | | | | exceeds DATALINK_READY. When we go back to READY or less (eg. ``close lcp''), switch the carrier-checking-timer off again. This fixes the callback example in ppp.conf.sample. Noted as broken by: Damian Kuczynski <damian@best.pw.edu.pl>
* The CCP layer now behaves as follows:brian1998-06-301-4/+6
| | | | | | | | | | | | | o If we've denied and disabled all compression protocols, stay in ST_INITIAL and do an LCP protocol reject if we receive any CCP packets. o If we've disabled all compression protocols, go to ST_STOPPED and wait for the other side to ask for something. o If we've got anything enabled, start REQing as soon as the auth layer is up. o If we're in multilink mode, than the link level CCP goes straight to ST_STOPPED irrespective of what's configured so that we never try to compress compressed stuff by default.
* Remove redundant includesbrian1998-06-271-2/+1
|
* Add ``ipcp'' as an optional argument to ``open'', and makebrian1998-06-251-2/+3
| | | | | | | | | open capable of re-negotiatiating the various layers. It is now possible to change various link options and then re-open the relevant layer, making the changes effective - for example, switching off VJ compression or starting ECHO LQRs on-the-fly.
* o If we come out of select() with only write descriptors thatbrian1998-06-241-4/+7
| | | | | | | | | | | end up writing zero bytes, sleep for 1/10 of a second so that we don't end up using up too much cpu. This should only ever happen on systems that wrongly report a descriptor as writable despite the tty buffer being full. Discussed with: Jeff Evarts o Do an initial run-time check to see if select() alters the passed timeval. This knowledge isn't yet used, but will be soon.
* Create & use fsm2initial(), a function to bring abrian1998-06-201-17/+6
| | | | | state machine back to ST_INITIAL without going through any unnecessary TLS/TLF pairs.
* Only set the datalink::stayonline flag if webrian1998-06-161-4/+5
| | | | | close/down with CLOSE_LCP when our state is DATALINK_READY or higher.
* Make `close lcp' just close the LCP layer and not hangup. This isbrian1998-06-151-11/+25
| | | | | | useful for slirp users that wish to get their shell back after the ppp session. `close' with no args still hangs up as expected. Required by: jmz
* o Maintain a link-type mask for open datalinks as well asbrian1998-06-121-1/+2
| | | | | | | | | | | for all datalinks in a bundle. Ppp now deals correctly with link types that are changed while open o When changing the type of the last AUTO link, only clear the interface if we're not in PHASE_NETWORK. This allows us to switch to -ddial mode while we have a connection without suddenly unexpectedly throttling ourselves by clearing the interface configuration. Problem area noted by: Aaron Jeremias Luz <aaron@csh.rit.edu>
* o Make modes consistent throughout ppp. The same strings are usedbrian1998-05-291-11/+12
| | | | | | | | | | | | | | | in `set mode', `allow modes', on the command line and when outputting mode names. The strings are matched so that only enough characters to uniquely identify the string are required, so you can now ppp -a mylabel (for auto mode) ppp -b mylabel (for background mode) ppp -dd mylabel (for direct dial mode) etc. o Make -ddial dial when specified on the command line (oops). Pointed out by: Alex <garbanzo@hooked.net>
* o Don't forget to close our transfer socket if we cannotbrian1998-05-281-3/+4
| | | | | | | generate the data to transfer. o Transfer uucp lock ownership for the transferred device. o Don't assume we know the correct values of dev_is_modem and mbits after the transfer.
* o Don't try to transfer tty device descriptors as there's no way ofbrian1998-05-251-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | transferring session rights with them. Instead, create two `/bin/cat' processes. A new child is spawned and disassociated from the terminal and the parent, which continues with the rest of the ppp process. Meanwhile, the parent spawns another child, and both the parent and child exec the `/bin/cat' commands with the appropriate descriptors. This way, the session is owned by the parent, and the tty is held open. o Close LCPs that have done a TLF and are now in ST_STOPPED before calling Down. This prevents them from trying to come back up again after the peer has shut them down (it seems a bit strange that the rfc says that a Down in ST_STOPPED will cause a TLS etc). o Don't try to set the physical link name pointer when we're receiving and renaming a datalink. The physical hasn't been created yet, and as it happens, the garbage physical pointer happens to be the value of another physical - so we're pointing that other physical name at ourselves. yeuck. o Re-arrange the order of things in main (DoLoop()). We now handle signals only after the select and not before the UpdateSet. It's possible that either a signal (FSM timeout) or a descriptor_Read() brings a link down, after which we'd better tidy up any dead direct and 1off descriptors before calling UpdateSet() again. o Mention when we detect a PPP packet when we see one before the link is up (then start LCP as before).
* o Move our prompt descriptor list outside of the bundle.brian1998-05-231-4/+1
| | | | | | | | | | | | | | | | | | | | It's now dealt with by the `server' object. This simplifies things as we only have one list of prompt descriptors and the log_ routines check prompt::logactive to determine whether it should be used for output. o Include the MP socket UpdateSet() result in bundle::UpdateSet(). o Don't select on the tun device unless we're in NETWORK phase or AUTO mode. o Stop the idle timer when we go to DEAD phase. We may have transferred a link and not had a chance to kill it. o Don't fail when trying to unlink our transferred datalink from our descriptor lists just before the transfer. o Add our link descriptor to the write set if we got a short write the last time (physical::out is set). o Log the connection source address when a connection is closed. o Remove descriptor::next field. Descriptor lists are not required any more.
* o If all CCPs are disabled & denied, don't send a REQ - just enterbrian1998-05-231-2/+4
| | | | STOPPED state waiting for the peer to say something.
* MFMP: Make ppp multilink capable.brian1998-05-211-0/+1096
See the file README.changes, and re-read the man page.
OpenPOWER on IntegriCloud