summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ipcp.c
Commit message (Collapse)AuthorAgeFilesLines
* Decouple pap & chap output routines from the correspondingbrian1999-02-061-4/+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
* Encode & Decode the PROTOCOMP fields correctly.brian1999-02-021-14/+41
| | | | | | | When NAKing the peer, get as close as we can to what he REQd. When the peer NAKs us, get as close as we can to what they NAKd with on our next REQ.
* Initial RADIUS support (using libradius). See the man page forbrian1999-01-281-16/+41
| | | | | | | | | | | | | | | | | | | 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
* Add ``enable proxyall'' support. This adds proxy ARP entriesbrian1998-10-261-5/+47
| | | | | | | | | | for every machine on every class C or smaller subnet that we route to. Add ``set {send,recv}pipe'' for controlling our socket buffer sizes. Mention the IP number with the problem in a few error messages. All submitted by: Craig Leres <leres@ee.lbl.gov> Modified slightly by: me
* Solve the ``first connection'' problem that occurs onbrian1998-10-221-144/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | demand-dial links with dynamic IP numbers where the program that causes the dial bind()s to an interface address that is subsequently changed after ppp negotiation. The problem is defeated by adding negotiated addresses to the tun interface as additional alias addresses and providing a set of ``iface'' commands for managing the interface. Libalias is also required (and what a name clash!) - it happily IP-aliases the address so that the source is that of the primary (negotiated) interface and un-IP-aliases it on the way back. An ``enable iface-alias'' is done implicitly by the -alias command line switch. If -alias isn't given, iface-aliasing is disabled by default and can't be enabled 'till an ``alias enable yes'' is done. ``alias enable no'' silently disables iface-alias. So, for dynamic-IP-type-connections, running ``ppp -alias -auto blah'' will work for the first connection, although existing bindings will not survive a disconnect/connect as the TCP peer will be trying to send to the old IP address - the packets won't route. It's now a lot easier to add IPXCP to ppp with minor updates to the new iface.[ch] (if anyone ever gets 'round to it). It's also now possible to manually add interface aliases with something like ``iface add 1.2.3.4/24 5.6.7.8''. This allows multi-homed ppp links :-)
* Sync with OpenBSD ifdefsbrian1998-09-171-4/+8
|
* Don't cast potentially unaligned addresses to pointers tobrian1998-09-041-14/+16
| | | | | non-char types on non-i386 architectures. On Alpha and Sparc we get a bus error if we do.
* Put the IP buffer queues into struct ipcp.brian1998-08-261-3/+4
| | | | Forgotten by: me
* o Support callback types NONE, E.164, AUTH and CBCP.brian1998-08-071-2/+2
| | | | | | | | | | | | | | (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.
* o Fix remaining sizeof problems for 64 bit machines.brian1998-06-271-11/+8
| | | | | | | | | | 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.
* More u_long -> u_int32_tbrian1998-06-271-3/+3
|
* Remove redundant includesbrian1998-06-271-2/+1
|
* Don't dlopen()/dlsym() libalias, use it in the same waybrian1998-06-271-3/+6
| | | | as the rest of the world uses libraries.
* Add ``ipcp'' as an optional argument to ``open'', and makebrian1998-06-251-7/+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.
* Change some log levels. ALERTs are only logged whenbrian1998-06-161-4/+4
| | | | | | something that can't happen happens or when everyone needs to know. ERRORs are only logged when something unexpected happens.
* Fix a rather nasty use of `static'. This caused a SEGVbrian1998-06-151-2/+2
| | | | | when running ``link * load label'' as we ended up recursing back into command_Interpret after nuking our command arg list.
* Give ``load'' optional context. It's now possible tobrian1998-06-151-10/+10
| | | | | ``link 1,2,3 load label'' for people that want to set up their links in a more mpd-like manner.
* o Maintain a link-type mask for open datalinks as well asbrian1998-06-121-2/+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-4/+4
| | | | | | | | | | | | | | | 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 Move our prompt descriptor list outside of the bundle.brian1998-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | 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.
* MFMP: Make ppp multilink capable.brian1998-05-211-380/+786
| | | | See the file README.changes, and re-read the man page.
* Remove unused #includes.brian1998-01-211-5/+2
| | | | | | Make various bits static. Remove unused variables. Submitted by: eivind
* Allow an optional delay when specifying "set openmode active".brian1998-01-201-4/+5
| | | | | | | | | | | | | | | | 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.
* Allow "set vj" for changing the default number of slotsbrian1998-01-181-6/+48
| | | | | | and whether slot compression is requested. Don't show current values with "show ipcp" if IPCP isn't "opened".
* o Allow the use of HISADDR as the first arg to "add".brian1998-01-051-1/+38
| | | | | | | | | | | | | | o Allow a forth argument in ppp.secret, specifying a new label. This gives control over which section of ppp.link{up,down} is used based on the authenticated user. o Support random address ranges in ppp.secret (not just in ppp.conf). o Add a AUTHENTICATING INCOMING CONNECTIONS section to the man page. o Add a bit more about DEFLATE in the man page. o Fix the incorrect "you must specify a password in interactive mode" bit of the manual. o Space things in the man page consistently. o Be more precice about where you can use MYADDR, HISADDR and INTERFACE in the "add" command documentation.
* Show who closes the diagnostic connection.brian1997-12-271-2/+5
| | | | | | Show the IP range (if specified) in "show ipcp". Close unused descriptors 0 and 2 in interactive mode. Pass (size_t *) rather than (int *) to sysctl().
* Cosmetic (style):brian1997-12-241-15/+15
| | | | | | | sizeof(var) -> sizeof var sizeof type -> sizeof(type) Suggested by: J Wunsch <j@uriah.heep.sax.de>
* Use sizeof cftypes128 for NCFTYPES128 macro, not sizeof cftypes !brian1997-12-241-2/+2
| | | | Lucky that sizeof cftypes < sizeof cftypes128
* If the peer asks for IP 0.0.0.0, choose an IP ourselvesbrian1997-12-191-2/+3
| | | | | without looking for it in our IP list (and if found, trying to ifconfig it!).
* Allow random IP number allocation to peer.brian1997-12-131-9/+30
| | | | | | | | | | | | | | | | | | | | 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.
* Correct cftypes128 index.brian1997-12-061-2/+2
|
* Remove duplicate REJECTED macro.brian1997-12-041-24/+18
| | | | Remove extraneous pointers.
* Abstract the CCP layer a level.brian1997-12-031-14/+27
| | | | Add DEFLATE support.
* Fix prototypes.brian1997-11-221-5/+7
| | | | | | | | | | | | | | 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).
* Add throughput logging (disabled by default).brian1997-11-181-58/+18
| | | | | Use "enable throughput" to see modem & IPCP throughput. Removed an extraneous prompt()
* Update the cftypes arrays according to rfc1700.brian1997-11-141-7/+28
| | | | Log IPCP reqests as IPCP.
* Finish the security improvements:brian1997-11-111-2/+2
| | | | | | | | | | | | | | | | | | | o Add "allow" command: "allow users a b c" gives access to users a, b and c. "allow modes auto" gives those users access to auto mode only. "allow users *" and "allow modes *" are accepted. No users and all modes are allowed by default. UID 0 can do anything. o Set the current label with the "load" and "dial" commands so that the call to ppp.linkdown makes sense. o Up the verison number. o Don't OR MODE_AUTO for -background and -ddial. o Don't OR MODE_INTER when we get a diagnostic connection. o Allow up to 40 args per line (was 20). o "set ifaddr" only changes the interface in AUTO mode (with other modes, it happens after IPCP negotiation). o Sort command descriptions in the man page. o Support -dedicated mode where we just talk ppp forever (no login etc).
* Don't pass global vars as args.brian1997-11-081-7/+7
| | | | Remove local/global conflicts.
* o Bump version to 1.3 to reflect major changesbrian1997-10-291-1/+2
| | | | | | | | | | | | o Report modem connect time properly o Report bytes in/out over physical media o Fix phases (TERMINATE is *higher than* DEAD) o Do a LayerFinish from LcpDown o Bring down IPCP & CCP when we enter PHASE_TERMINATE o Give a new prompt when we go to PHASE_DEAD o Stop the modem timer properly when idle o Treat sig 15 like an exiting carrier loss o Log (DEBUG) offline & online transitions
* Cosmetic:brian1997-10-261-1/+2
| | | | Move prototypes into the correct headers.
* Cosmetic (no functional changes):brian1997-10-261-43/+51
| | | | | | | | | | | | | | | 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
* Ask for VJ slot id compression by default.brian1997-10-171-2/+2
|
* Support VJ maximum slot identifiers != 15.brian1997-10-071-1/+6
| | | | | | | | | 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.
* Bring CCP and IPCP layers down properly when LCPbrian1997-09-031-9/+39
| | | | | comes down. Give a count of bytes sent/received in IPCP log.
* Cosmetic: Make LogPrintf() calls consistent.brian1997-08-311-14/+11
|
* Make the code format more in line with style(9).brian1997-08-251-124/+112
| | | | | Update loadalias to use the new libalias api. Update to version 1.1.
* Expand the "set stopped" command so that it canbrian1997-08-201-28/+30
| | | | | | | | idependently time out any of the FSMs. Split LCP logging into LCP, IPCP and CCP logging, and make room in "struct fsm" for the log level that the state machine should use.
* Correct the forth arg to "set ifaddr". If specified,brian1997-08-191-7/+13
| | | | | it gives the IP number that should be used for initial IPCP config requests, irrespective of MYADDR.
* Set up the alias address before executingbrian1997-07-291-3/+3
| | | | the contents of ppp.linkup.
* Add "set server" to control the server socket.brian1997-06-251-2/+2
| | | | | | | | | | Catch SIGUSR1 to re-init listening socket. Document signal behaviour. Add missing '\n's to LogPrintf(LogWARN,...) Main() returns int not void. AF_LOCAL ideal suggested a long time ago by: joerg
OpenPOWER on IntegriCloud