summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/fsm.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace various spelling with FALLTHROUGH which is lint()ablecharnier2002-08-251-1/+1
|
* A better prinflike fix...brian2002-06-151-2/+2
|
* Fix a printflike format errorbrian2002-06-151-1/+1
|
* Increase the maximum FSM option length to 50brian2002-05-221-2/+2
|
* o Clean up some #includesbrian2002-05-141-1/+0
| | | | | | | | | | | | | | | | | | o Bump version number to 3.0.4 o When talking to a RADIUS server, provide a NAS-Port-Type. When the NAS-Port-Type is Ethernet, provide a NAS-Port value equal to the SESSIONID from the environment in direct mode or the NGM_PPPOE_SESSIONID message in other modes. If no SESSIONID is found, default to the interface index in client mode or zero in server mode. When the NAS-Port-Type is ISDN, set the NAS-Port to the minor number of the physical device (ie, the N in /dev/i4brbchN). This makes it easier for the RADIUS server to identify the client WRT accounting data etc. Prompted by: lsz8425 <lsz8425@mail.cd.hn.cn>
* If we receive a config request while Open, call TLD *before* decodingbrian2002-05-011-3/+7
| | | | | | | the request as TLD may initialise fields that are set when decoding the request. MFC after: 1 week
* Make the way FSM options are processed easier to read by using structuresbrian2002-04-161-29/+127
| | | | | | | | | | | instead of u_char *. The changes are cosmetic except: RecvConfigAck() now displays the options that are being ACK'd Huge (bogus) options sent from the peer won't cause an infinite loop SendIdent and ReceiveIdent are displayed consistenlty with other FSM data LCP AUTHPROTO options that aren't understood are NAK'd, not REJ'd
* Add a missing breakbrian2002-03-301-0/+1
|
* Back out the previous fix to deal with kernels that don't support IPv6,brian2001-08-181-2/+1
| | | | | | | | | | | | | | | and implement a far more subtle and correct fix. The reason behind the infinite loop was that ppp was trying to make up initial IPv6 numbers and wasn't giving up when it failed unexpectedly to assign the addresses it just fabricated to it's interface (thinking that the reason was because another interface was using the same address). It now attempts this up to 100 times before just failing and trying to muddle along (in reality, this should never happen more than a couple of times unless our random number generator doesn't work). Also, when IPv6 is not available, don't even try to assign the IPv6 interface address in the first place...
* Run correctly on a machine built without AF_INET6 supportbrian2001-08-181-1/+2
|
* o Add ipv6 support, abstracting most NCP addresses into opaquebrian2001-08-141-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | structures (well, they're treated as opaque). It's now possible to manage IPv6 interface addresses and routing table entries and to filter IPV6 traffic whether encapsulated or not. IPV6CP support is crude for now, and hasn't been tested against any other implementations. RADIUS and IPv6 are independent of eachother for now. ppp.linkup/ppp.linkdown aren't currently used by IPV6CP o Understand all protocols(5) in filter rules rather than only a select few. o Allow a mask specification for the ``delete'' command. It's now possible to specifically delete one of two conflicting routes. o When creating and deleting proxy arp entries, do it for all IPv4 interface addresses rather than doing it just for the ``current'' peer address. o When iface-alias isn't in effect, don't blow away manually (via ``iface add'') added interface addresses. o When listening on a tcp server (diagnostic) socket, bind so that a tcp46 socket is created -- allowing both IPv4 and IPv6 connections. o When displaying ICMP traffic, don't display the icmp type twice. When display traffic, display at least some information about unrecognised traffic. o Bump version Inspired after filtering work by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
* Add support for stateful MPPE (microsoft encryption) providingbrian2001-06-181-9/+11
| | | | | | | | | | | | | | | encryption compatibility with Windows 2000. Stateful encryption uses less CPU but is bad on lossy transports. The ``set mppe'' command has been expanded. If it's used with any arguments, ppp will insist on encryption, closing LCP if the other end refuses. Unfortunately, Microsoft have abused the CCP reset request so that receiving a reset request does not result in a reset ack when using MPPE... Sponsored by: Monzoon Networks AG and FreeBSD Services Limited
* Convert IIJ copyrights to BSD copyrights.brian2001-06-131-18/+24
| | | | Approved by: Toshiharu OHNO <tohno@sirius.ocn.ne.jp>
* If executing the stuff from ppp.linkdown results in a state change,brian2001-01-261-4/+6
| | | | | | | don't continue adjusting the ipcp state machine. This allows ``down'' to work in ppp.linkdown - useful for a tunnel setup.
* Support link identification from rfc1570brian2000-07-191-8/+32
| | | | Two new commands are available; ``ident'' and ``sendident''.
* Don't oan about padding charactersbrian2000-06-111-2/+0
|
* If the fsm header reports a length greater than the packet size,brian2000-05-261-1/+8
| | | | | drop the packet rather than just whinging about it in the log. If the fsm header has a smaller length, continue to whinge.
* Add a bunch of `const's and fix a typo.brian1999-12-271-2/+2
| | | | Submitted by: Rich Neswold <rneswold@MCS.Net>
* Cosmetic: Make struct mbuf more like kernel mbufs.brian1999-12-201-48/+48
|
* Support PPPoEbrian1999-11-061-2/+10
| | | | | Help (lots) from: julian, archie Facilities from: ahebert@pubnix.net
* Mention the received/expected magic for dodgy ECHO LQRs.brian1999-10-061-2/+3
|
* o Split the two IPCP queues into three - one for FSM databrian1999-09-041-4/+5
| | | | | | | | | | | | (LCP/CCP/IPCP), one for urgent IP traffic and one for everything else. o Add the ``set urgent'' command for adjusting the list of urgent port numbers. The default urgent ports are 21, 22, 23, 513, 514, 543 and 544 (Ports 80 and 81 have been removed from the default priority list). o Increase the buffered packet threshold from 20 to 30. o Report the number of packets in the IP output queue and the list of urgent ports under ``show ipcp''.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* If we receive an IPCP protocol reject, bring it down.brian1999-08-101-1/+8
|
* o Alter the mbuf type as it's processed by different layers.brian1999-06-021-16/+15
| | | | | | | | o Show more information about missing MP fragments in ``show mp''. o Do away with mbuf_Log(). It was showing mbuf stats twice on receipt of LCP/CCP/IPCP packets.... ???!!? o Pre-allocate a bit extra when creating LQR packets to avoid having to allocate another mbuf in mbuf_Prepend().
* Handle LCP echo reqs properly again (broken with thebrian1999-05-141-17/+3
| | | | layering changes).
* Deal with the fact that as we now mbuf_Read the fsmbrian1999-05-091-27/+27
| | | | | | | | | header in fsm_Input() we often end up with a NULL mbuf. Deal with a possible NULL mbuf being passed into mbuf_Prepend(). Adjust some spacing to make things more consistent.
* o Redesign the layering mechanism and make the aliasing code part ofbrian1999-05-081-24/+26
| | | | | | | | | | | | | | | | | | | | | 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''.
* Ensure that the thing we're casting to struct ipbrian1999-03-291-1/+2
| | | | is aligned for non-i386 architectures.
* Comment why we do a TLF when we get a ``Down'' event in statebrian1999-03-011-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | ``closing''. Pointed out by: archie Don't do a TLF when we get a ``Catastrphic Protocol Reject'' event in state ``closed'' or ``stopped''. Pointed out but not suggested by: archie This makes no difference in the current implementation as LcpLayerFinish() does nothing but log the event, but I disagree in principle because it unbalances the TLF/TLS calls which (IMHO) doesn't fit with the intentions of the RFC. Maybe the RFC author had a reason for this. It can only happen in two circumstances: - if LCP has already been negotiated then stopped or closed and we receive a protocol reject, then we must already have done a TLF. Why do one again and stay in the same state ? - if LCP hasn't yet been started and we receive an unsolicted protocol reject, why should we TLF when we haven't done a TLS ?
* Allow control over the number of ConfigREQ & TermREQ attemptsbrian1999-02-261-25/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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
* Don't cast potentially unaligned addresses to pointers tobrian1998-09-041-4/+5
| | | | | non-char types on non-i386 architectures. On Alpha and Sparc we get a bus error if we do.
* When we receive an LCP config REQ in Opened state,brian1998-08-011-6/+8
| | | | | | | | do TLD *before* processing the config request as TLD initialises the peers LCP values. It's strange that an IRC isn't required here - but I'll bow to the wisdom of the rfc.
* The CCP layer now behaves as follows:brian1998-06-301-1/+16
| | | | | | | | | | | | | 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.
* o Fix remaining sizeof problems for 64 bit machines.brian1998-06-271-5/+20
| | | | | | | | | | o Allow ``set ....'' when we have multiple links but aren't in multilink mode. o Do a TLS when we receive a ``Open'' event in ``Closed'' state, despite the rfc state transition table. This is clearly an error in the RFC as TLS cannot have yet been called (without TLF) in the ``Closed'' state. I've posted a message to comp.protocols.ppp for confirmation.
* Add ``ipcp'' as an optional argument to ``open'', and makebrian1998-06-251-1/+13
| | | | | | | | | 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.
* Do an InitRestartCounter when we get a TerminateReqbrian1998-06-201-1/+2
| | | | | | in Opened state..... I have no idea why this never caused problems in the past - maybe the restart counter was bogusly initialised somewhere else :-/
* Create & use fsm2initial(), a function to bring abrian1998-06-201-6/+14
| | | | | state machine back to ST_INITIAL without going through any unnecessary TLS/TLF pairs.
* Change some log levels. ALERTs are only logged whenbrian1998-06-161-2/+2
| | | | | | something that can't happen happens or when everyone needs to know. ERRORs are only logged when something unexpected happens.
* o De-staticise things that don't need to be static.brian1998-06-151-1/+2
| | | | | | | | | | o Bring the static ``ttystate'' into struct prompt so that the tilde context is per prompt and not global. o Comment the remaining static variables so that it's clear why they're static. o Add some XXX comments suggesting that our interface list and our hostname should be re-generated after a signal (say SIGUSR1) so that a machine with PCCARDs has a chance.
* MFMP: Make ppp multilink capable.brian1998-05-211-285/+425
| | | | See the file README.changes, and re-read the man page.
* Allow an optional delay when specifying "set openmode active".brian1998-01-201-6/+31
| | | | | | | | | | | | | | | | The delay defaults to 1 sec (as it always has) unless we've done a ~p in interactive mode or we've actually detected a HDLC frame. This is now cleanly implemented (via async timers) so that it is possible for LCP to come up despite the delay if an LCP REQ is received. This will hopefully solve situations with slow servers or slirp scenarios (where ECHO is left on the port for a second or so before the peer enters packet mode). Also, ~p in interactive mode no longer changes the value of the default openmode delay and -dedicated mode enters packet mode in the right state according to the value of openmode.
* Implement Reset{Req,Ack} properly, as per rfc 1962.brian1998-01-101-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (I completely mis-read the rfc last time 'round!) This means: o Better CCP/WARN Reset diagnostics. o After we've sent a REQ and before we've received an ACK, we drop incoming compressed data and send another REQ. o Before sending an ACK, re-sequence all pending PRI_NORMAL data in the modem queue so that pending packets won't get to the peer *after* the ResetAck. o Send ACKs with the `identifier' from the REQ frame. o After we've received a correct ACK, duplicate ACKs are ok (and will reset our history). o Incorrect ACKs (not matching the last REQ) are moaned about and dropped. Also, o Calculate the correct FCS after compressing a packet. DEFLATE *may* produce an mbuf with more than a single link in the chain, but HdlcOutput didn't know how to calculate the FCS :-( o Make `struct fsm'::reqid a u_char, not an int. This fix will prevent us from sending id `255' 2,000,000,000 times before wrapping to `0' for another 2,000,000,000 sends :-/ o Bump the version number a little. The end result: DEFLATE now works over an unreliable link layer. I can txfr a 1.5Mb kernel over a (rather bad) null-modem cable at an average of 21679 bytes per second using rcp. Repeat after me: Don't test compression using a loopback ppp/tcp setup as we never lose packets and therefore never have to reset!
* Cosmetic (style):brian1997-12-241-4/+4
| | | | | | | sizeof(var) -> sizeof var sizeof type -> sizeof(type) Suggested by: J Wunsch <j@uriah.heep.sax.de>
* Allow random IP number allocation to peer.brian1997-12-131-2/+3
| | | | | | | | | | | | | | | | | | | | Validate the peers suggested IP by attempting to make a routing table entry. Give up IPCP negotiation if the peer NAKs us with an unusable IP. Always SIOCDIFADDR then SIOCAIFADDR when configuring the tun device. Using SIOCSIFDSTADDR allows duplicate dst addresses (which we don't want)!!! Allow up to 200 interface names (was 50) (now that ppp can play server properly). Up the version number (1.5 -> 1.6). Cosmetic: Log unexpected CCP packets in the CCP log rather than the ERROR log. Log unexpected Config Reqs in the appropriate LCP/IPCP/CCP log rather than the ERROR log. Log failed route additions and deletions with WARN, not TCPIP. Log the option id and length for unrecognised IPCP options. Change some .Sq to .Ar in the man page.
* Abstract the CCP layer a level.brian1997-12-031-5/+4
| | | | Add DEFLATE support.
* Fix prototypes.brian1997-11-221-4/+8
| | | | | | | | | | | | | | Remove extraneous decls. Add ``const'' to several places. Allow ``make NOALIAS=1'' to remove IP aliasing. Merge with OpenBSD - only the Makefiles vary. We can now survive a compile with -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings -Wchar-subscripts (although the Makefile just contains -Wall).
* Don't moan about unexpected config req's when in ST_STOPPING.brian1997-11-111-2/+2
|
* Cosmetic (no functional changes):brian1997-10-261-27/+46
| | | | | | | | | | | | | | | o Add missing $Id$s o Move extern decls from .c -> .h files o Staticize o Remove #includes from .h files o style(9)ify includes o bcopy -> memcpy bzero -> memset bcmp -> memcmp index -> strchr rindex -> strrchr o Move timeout.h -> timer.h (making it consistent w/ timer.c) o Add -Wmissing-prototypes
OpenPOWER on IntegriCloud