aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/vjcomp.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC: EverythingBrian Somers2002-09-011-1/+5
| | | | | | | | | | | | | | | | | | | | Notably, this includes the following: o IPv6 support o Better RADIUS support (including MS-CHAP) o Improved handling of bad negotiation options o Improved negotiation diagnostics o Improved sockaddr (RTAX) parsing o More consistent compile time options (NOXXX to compile something out) o More available macros o Firewall punching o Improved ``proxy'' and ``proxyall'' handling o Handle connected UDP sockets on descriptor 0 in -direct mode o Fix a load of typos o Update to internal version 3.1 Notes: svn path=/stable/4/; revision=102753
* MFC: Convert IIJ copyrights to BSD copyrights.Brian Somers2001-06-131-18/+25
| | | | Notes: svn path=/stable/4/; revision=78190
* Implement mbuf allocation internally by maintaining 8 buckets ofBrian Somers1999-12-201-5/+4
| | | | | | | | | | different sized mbufs, and mallocing them in chunks of 20 mbufs at a time. This improves back-to-back throughput by between 7 and 8% Notes: svn path=/head/; revision=54913
* Cosmetic: Make struct mbuf more like kernel mbufs.Brian Somers1999-12-201-12/+12
| | | | Notes: svn path=/head/; revision=54912
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50479
* Add ISDN support via isdnd & i4b. This requires versionBrian Somers1999-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 !) :-] Notes: svn path=/head/; revision=49472
* o Alter the mbuf type as it's processed by different layers.Brian Somers1999-06-021-3/+7
| | | | | | | | | | | 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(). Notes: svn path=/head/; revision=47695
* Allow ``host:port/udp'' devices and support ``host:port/tcp'' asBrian Somers1999-05-121-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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(). Notes: svn path=/head/; revision=47061
* Deal with the fact that as we now mbuf_Read the fsmBrian Somers1999-05-091-2/+2
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=46828
* o Redesign the layering mechanism and make the aliasing code part ofBrian Somers1999-05-081-30/+35
| | | | | | | | | | | | | | | | | | | | | | | | 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''. Notes: svn path=/head/; revision=46686
* Avoid a few warnings on the alphaBrian Somers1999-03-311-1/+2
| | | | Notes: svn path=/head/; revision=45193
* Ensure that the thing we're casting to struct ipBrian Somers1999-03-291-5/+7
| | | | | | | is aligned for non-i386 architectures. Notes: svn path=/head/; revision=45103
* Decouple pap & chap output routines from the correspondingBrian Somers1999-02-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=43693
* Initial RADIUS support (using libradius). See the man page forBrian Somers1999-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 Notes: svn path=/head/; revision=43313
* Fix some OpenBSD/alpha warningsBrian Somers1998-08-261-1/+2
| | | | Notes: svn path=/head/; revision=38559
* o Support callback types NONE, E.164, AUTH and CBCP.Brian Somers1998-08-071-2/+1
| | | | | | | | | | | | | | | | | (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. Notes: svn path=/head/; revision=38174
* o Fix remaining sizeof problems for 64 bit machines.Brian Somers1998-06-271-1/+2
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=37210
* Change some log levels. ALERTs are only logged whenBrian Somers1998-06-161-3/+3
| | | | | | | | | something that can't happen happens or when everyone needs to know. ERRORs are only logged when something unexpected happens. Notes: svn path=/head/; revision=37019
* o De-staticise things that don't need to be static.Brian Somers1998-06-151-2/+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. Notes: svn path=/head/; revision=37010
* o Pass our negotiated number of VJ slots intoBrian Somers1998-06-141-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | sl_uncompress_tcp() and drop packets with slot numbers that are out of range. o Drop packets that want to use a slot that still has an IP header length of 0 (ie, the requested slot number is bogus again). Without this code, if the other side mis-behaves (and sends us garbage slot numbers), we happily ``adjust'' a memset(..., '\0', ...) TCP/IP header and promptly cr*p all over the stack before returning.... quickly followed by a SIGBUS. Dodgy ISP used by, and help locating the problem from: jmz Problem also seen by: Mourad de Riche <omnibus@image.dk> There's still a link lockup after this happens, but my bets are on the other side (who has already started sending rubbish) being to blame. Notes: svn path=/head/; revision=36960
* MFMP: Make ppp multilink capable.Brian Somers1998-05-211-35/+45
|\ | | | | | | | | | | | | See the file README.changes, and re-read the man page. Notes: svn path=/head/; revision=36285
| * o Increment expected MP fragment numbers correctly,Brian Somers1998-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | according to SHORTSEQ negotiation. o Don't forget to attach incoming fragments with a number greater than everything else in the queue (rather than leaking memory). o Output the link name with the ``other'' hdlc diagnostic message. o Correct a VJ diagnostic (`COMPPROTO', not `proto'). Notes: svn path=/cvs2svn/branches/MP/; revision=35667
| * Cosmetic: Make our external function names consistent.Brian Somers1998-05-011-16/+16
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35605
| * o Add the link name to modem diagnostics.Brian Somers1998-04-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Create struct mpserver as part of struct mp. mpserver creates a unix-domain socket based on the peers auth name and endpoint discriminator. If it already exists, ppp will ``pass the link'' over to the owner of the socket, joining it into the bundle of another ppp invocation, otherwise ppp waits for other invocations to pass it links through this socket. The final piece of code will be the code that flattens our datalink info and passes it down this channel (not yet implemented). Notes: svn path=/cvs2svn/branches/MP/; revision=35481
| * o Move the accept/deny/disable/enable globals either to theBrian Somers1998-04-161-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bundle (non-negotiated vars) or to their respective IPCP, LCP or CCP. o Enable rolling throughput statistics by default. o Remove the `display' command. These values now appear in `show bundle', `show ipcp', `show ccp' and `show lcp'. o Initialise auth name & key at bundle create time (oops). o Rename pppd-deflate (the id-24 hack) to deflate24. o Don't send both a REJ and a NAK to an IPCP or LCP REQ. Favour the REJ (already done at the CCP level). o Recurse in datalink_UpdateSet() when we change state, otherwise we end up setting no descriptors and getting jammed in the imminent select() instead of doing the dial/login/hangup. o Display our CHAP encryption method despite being built with DES. o Display VJ as not negotiated in ``show ipcp'' when necessary. Notes: svn path=/cvs2svn/branches/MP/; revision=35219
| * o Move alias function pointers into loadalias.cBrian Somers1998-04-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | o Move Var*Version into command.c o Remove struct pppVars (and there was much rejoicing) ! o Forward-decl some structs in .h files to avoid include ordering requirements and remove a few more redundant #includes. Notes: svn path=/cvs2svn/branches/MP/; revision=35089
| * Remove unused includes.Brian Somers1998-04-061-2/+1
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35059
| * o Move struct lcp and struct ccp into struct link.Brian Somers1998-04-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Remove bundle2lcp(), bundle2ccp() and bundle2link(). They're too resource-hungry and we have `owner pointers' to do their job. o Make our FSM understand LCPs that are always ST_OPENED (with a minimum code that != 1). o Send FSM code rejects for invalid codes. o Make our bundle fsm_parent deal with multiple links. o Make timer diagnostics pretty and allow access via ~t in `term' mode (not just when logging debug) and `show timers'. Only show timers every second in debug mode, otherwise we get too many diagnostics to be useful (we probably still do). Also, don't restrict ~m in term mode to depend on debug logging. o Rationalise our bundles' phases. o Create struct mp (multilink protocol). This is both an NCP and a type of struct link. It feeds off other NCPs for output, passing fragmented packets into the queues of available datalinks. It also gets PROTO_MP input, reassembles the fragments into ppp frames, and passes them back to the HDLC layer that the fragments were passed from. ** It's not yet possible to enter multilink mode :-( ** o Add `set weight' (requires context) for deciding on a links weighting in multilink mode. Weighting is simplistic (and probably badly implemented) for now. o Remove the function pointers in struct link. They ended up only applying to physical links. o Configure our tun device with an MTU equal to the MRU from struct mp's LCP and a speed equal to the sum of our link speeds. o `show {lcp,ccp,proto}' and `set deflate' now have optional context and use ChooseLink() to decide on which `struct link' to use. This allows behaviour as before when in non-multilink mode, and allows access to the MP logical link in multilink mode. o Ignore reconnect and redial values when in -direct mode and when cleaning up. Always redial when in -ddial or -dedicated mode (unless cleaning up). o Tell our links to `staydown' when we close them due to a signal. o Remove remaining `#ifdef SIGALRM's (ppp doesn't function without alarms). o Don't bother strdup()ing our physical link name. o Various other cosmetic changes. Notes: svn path=/cvs2svn/branches/MP/; revision=35009
| * Make struct bundle into a sort of `struct descriptor'.Brian Somers1998-03-201-1/+2
| | | | | | | | | | | | | | | | It does the fdsets/reads/writes for each of it's datalinks. Notes: svn path=/cvs2svn/branches/MP/; revision=34722
| * Move VJ compression state and stats into struct ipcp.Brian Somers1998-03-161-15/+9
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=34633
| * Move filter sets into struct bundle.Brian Somers1998-03-161-1/+2
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=34631
| * Move the IPCP into struct bundle.Brian Somers1998-03-131-4/+5
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=34557
| * De-staticise LQR informationBrian Somers1998-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Increment OutPackets for any packet - not just LQRs MFC: o Fix a few comment typos. o Fix ``set timeout'' usage message and documentation. o Change ifOutPackets, ifOutOctets and ifOutLQRs to `u_int32_t's so that they wrap correctly. o Put the LQR in network byte order using the correct struct size (sizeof u_int32_t, not sizeof u_long). o Wrap LQR ECHO counters correctly. o Don't increment OutLQR count if the last LQR hasn't been replied to. o Initialise last received LQR in StartLqm. o Don't start the LQR timer if we're `disabled' and `accepted'. o Generate LQR responses when both sides are using a timer and we're not going to send our next LQR before the peers max timeout. Notes: svn path=/cvs2svn/branches/MP/; revision=34530
| * o Remove the global CcpInfo. It's now part of the datalink.Brian Somers1998-02-231-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Struct bundle will have its own struct ccp in the future too. o The ``set stopped'' command now requires context and doesn't work on the IPCP FSM. o Check if it's time to break out of our top level loop before doing a select - otherwise, we'll select forever :-( o Remove `struct link'::ccp (a temporary hack). It turns out that IpStartOutput() calls link_Output() and link_Output() incorrectly calls StartOutput() (really modem_StartOutput) requiring the ccp knowledge so that it can call IpStartOutput()... The end result is that the whole IP output queue gets dumped into the modem output queue and a pile of physical writes are done prematurely. This makes the (original) code in main() actually work in that it would not bother selecting() on the tun descriptor when our modem queue length was 20 or greater. Instead, we now make that decision based on the overall queue length. This will need improvement later. Notes: svn path=/cvs2svn/branches/MP/; revision=33754
| * Shuffle around our FSMs a bit. This'll make itBrian Somers1998-02-211-4/+4
| | | | | | | | | | | | | | | | easier to remove the CcpInfo, LcpInfo and IpcpInfo globals. Notes: svn path=/cvs2svn/branches/MP/; revision=33702
| * Create `struct link' - the logical link from whichBrian Somers1998-01-301-3/+3
| | | | | | | | | | | | | | | | `struct physical' (and the future `struct logical') are derived. Notes: svn path=/cvs2svn/branches/MP/; revision=32903
| * o Move global/static IPCP data into IpcpInfo.Brian Somers1998-01-291-1/+4
| | | | | | | | | | | | | | | | | | | | | | o Use INADDR_ANY and INADDR_BROADCAST instead of 0 and 0xffffffff for IP addresses & masks. o Move struct compreq into ipcp.c (it's none of anyone elses business). o Rename MAX_STATES to MAX_VJ_STATES. Notes: svn path=/cvs2svn/branches/MP/; revision=32878
| * Create a new MP branch for `multilink protocol'.Brian Somers1998-01-291-3/+3
| | | | | | | | | | | | | | | | Do lots of initial shuffling and grouping. Submitted by: Eivind Eklund <perhaps@yes.no> Notes: svn path=/cvs2svn/branches/MP/; revision=32863
| * This commit was manufactured by cvs2svn to create branch 'MP'.cvs2svn1998-01-291-0/+164
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=32861
* Remove unused #includes.Brian Somers1998-01-211-5/+4
| | | | | | | | | Make various bits static. Remove unused variables. Submitted by: eivind Notes: svn path=/head/; revision=32663
* Make things work when sizeof(long) != 32 (hopefully)Brian Somers1998-01-111-4/+4
| | | | Notes: svn path=/head/; revision=32439
* Abstract the CCP layer a level.Brian Somers1997-12-031-5/+15
| | | | | | | Add DEFLATE support. Notes: svn path=/head/; revision=31514
* Fix prototypes.Brian Somers1997-11-221-1/+2
| | | | | | | | | | | | | | | | | 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). Notes: svn path=/head/; revision=31343
* Introduce ID0 logging.Brian Somers1997-11-091-1/+2
| | | | | | | | | | | Stay as the invoking uid as much as possible. Execution as a normal user is still forbidden for now, so these changes are pretty ineffective. The next commit will implement the modifications suggested on -hackers a number of days ago. Notes: svn path=/head/; revision=31061
* Cosmetic (no functional changes):Brian Somers1997-10-261-4/+14
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=30715
* Support VJ maximum slot identifiers != 15.Brian Somers1997-10-071-3/+3
| | | | | | | | | | | | Support VJ slot id compression. Previously, ppp would negotiate a max slot between 2 & 15 (if asked), and would agree to slot id compression (if asked). It would then proceed to use 16 slots and no compression anyway. The result was a rather unusable connection. Notes: svn path=/head/; revision=30187
* Make the code format more in line with style(9).Brian Somers1997-08-251-26/+22
| | | | | | | | Update loadalias to use the new libalias api. Update to version 1.1. Notes: svn path=/head/; revision=28679
* Overhaul ppp:Brian Somers1997-06-091-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | o Use syslog o Remove references to stdout/stderr (incl perror()) o Introduce VarTerm - the interactive terminal or zero o Allow "set timeout" to affect current session o Change "set debug" to "set log" o Allow "set log [+|-]flag" o Make MSEXT and PASSWDAUTH stuff the default o Move all #ifdef DEBUG stuff into the code - this shouldn't be too much overhead. It's now controlled with "set log +debug" o Add "set log command, debug, tun, warn, error, alert" o Remove cdefs.h, and assume an ansi compiler. o Improve all diagnostic output o Don't trap SIGSEGV o SIGHUP now terminates again (log files are controlled by syslog) o Call CloseModem() when changing devices o Fix parsing of third arg of "delete" I think this fixes the "magic is same" problems that some people have been experiencing. The man page is being rewritten. It'll follow soon. Notes: svn path=/head/; revision=26516
* Only compress tcp packets. Calculate size ofBrian Somers1997-05-071-2/+3
| | | | | | | | | | logbuff rather than guessing at 2000. PR: 2046 Submitted by: torii@tcd.hitachi.co.jp Notes: svn path=/head/; revision=25561
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22997