summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/bundle.c
Commit message (Collapse)AuthorAgeFilesLines
* o Add the -foreground switch. This switch behaves like -background exceptbrian1999-08-191-2/+2
| | | | | | | | | that ppp stays in the foreground. o Add the -quiet switch to quieten ppps startup o Add the -nat flag and discourage the use of the -alias flag. Both do the same thing. o Correct some nat usage strings. o Change the internal ``alias'' command to ``nat''.
* Implement a minimum idle time value as an optional second argumentbrian1999-08-171-11/+38
| | | | | | to ``set timeout''. This is useful for situations where your minimum call charge is (say) 5 minutes (like mine is)
* Change printf formats %q[du] -> %ll[du]brian1999-08-091-3/+3
|
* Add ISDN support via isdnd & i4b. This requires versionbrian1999-08-061-3/+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 !) :-]
* o Obsolete the undocumented ``set weight'' command.brian1999-08-051-187/+157
| | | | | | | | | | | | | | | | | | | | | | | 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).
* o Overhaul filtering, adding facilities to jump over rules and tobrian1999-07-271-1/+10
| | | | | | | | | negate the sense of rules. o Remove the redundant (and undocumented) ``host'' and ``port'' words (README.changes updated). o Don't permit (and ignore) garbage instead of the protocol. Mostly submitted by: Peter Jeremy <jeremyp@gsmx07.alcatel.com.au>
* Disable TUNSLMODE when we first open the tun device.brian1999-06-221-2/+10
| | | | Submitted by: Ian West <ian@niw.com.au>
* Introduce the ``keep-session'' option. Refer to the manbrian1999-06-021-2/+5
| | | | | | page for details. This allows MP over non-tty devices where the original ppp process must not exit (such as sshd-spawned ppp sessions).
* Remember if MYADDR or HISADDR is used in a filter add tweak allbrian1999-05-311-1/+11
| | | | filters any time either value changes.
* Move the code for tweaking interface flags into one function.brian1999-05-271-62/+5
|
* Allow ``host:port/udp'' devices and support ``host:port/tcp'' asbrian1999-05-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-32/+15
| | | | | | | | | | | | | | | | | | | | | 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''.
* Add support for NetBSDbrian1999-04-261-4/+4
|
* Undo possible damage done by the new TUNSIFMODE ioctlbrian1999-03-251-1/+13
| | | | in FreeBSD-current.
* Read from fd[0] and write to fd[1] where `fd' is thebrian1999-03-071-12/+12
| | | | result of a pipe(). This matters under OpenBSD.
* Extend the ``set redial'' command to allow incrementalbrian1999-03-041-4/+4
| | | | redial timeouts.
* Bring up auto links despite there being no data queued ifbrian1999-03-011-5/+5
| | | | | | | | | | | | we're already in network phase and our autoload values are set with no minimum threshold (the default). Tell the autoload timer that it's ``coming up'' *before* calling AutoLoadTimeout() directly... not after. This prevents the very first demand-dial connection from immediately disconnecting when there are other auto links. Problem diagnosis: Ted Mittelstaedt <tedm@toybox.placo.com>
* Don't immediately bring auto links back up in multilinkbrian1999-02-251-3/+3
| | | | | | mode (when there is more than one auto link) if there is no data queued to go out. Reviewed by: Tom Torrance <tom@tomqnx.com>
* Decouple pap & chap output routines from the correspondingbrian1999-02-061-2/+15
| | | | | | | | | | | | | | | | | | | | | | | 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
* Initial RADIUS support (using libradius). See the man page forbrian1999-01-281-2/+17
| | | | | | | | | | | | | | | | | | | 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 warn when ``add xxxx HISADDR'' fails because HISADDRbrian1999-01-061-3/+4
| | | | | | is 0.0.0.0. This isn't a problem as the sticky route is still added. Suggested by: Chris Timmons <skynyrd@opus.cts.cwu.edu>
* Rather than interrupting 10 times per second then checkingbrian1998-12-141-2/+2
| | | | | | | | | | | to see if there's anything to do, schedule the next alarm based on the next required timeout. This decreases the load when there are lots of relatively idle ppp processes. While I'm in there, handle the possibility that a timeout makes the timer element go out of scope by grabbing the enext pointer before executing the timer function.
* When using ``set device !someprogram'', when ``someprogram''brian1998-12-101-1/+15
| | | | | | | exits, it causes a select() exception. Handle these select() exceptions on link descriptors in pretty much the same way as loss of carrier rather than dropping out in confusion.
* Don't call PacketAliasIn() when we turn around packets destinedbrian1998-10-291-7/+1
| | | | | | for our interface address. We're about to call ip_Input() anyway, and ip_Input() does the PacketAliasIn(). Stack trace provided by: Cameron Grant <gandalf@vilnya.demon.co.uk>
* Add ``set proctitle'' for changing argv[0]. All substitutionsbrian1998-10-271-1/+4
| | | | | | | are done in the same way as command execution. For example, ``set proctitle USER INTERFACE PROCESSID'' would be useful in a -direct profile for identifying who's connected.
* Add ``enable proxyall'' support. This adds proxy ARP entriesbrian1998-10-261-2/+26
| | | | | | | | | | 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
* Loosen our restrictions on setting enddisc, mrru,brian1998-10-241-1/+14
| | | | | | | | shortseq, authname and authkey. o Auth{name,key} may additionally be set in PHASE_ESTABLISH. o The others may be set in PHASE_ESTABLISH as long as no links have yet reached DATALINK_LCP.
* Solve the ``first connection'' problem that occurs onbrian1998-10-221-94/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
|
* Put the IP buffer queues into struct ipcp.brian1998-08-261-6/+6
| | | | Forgotten by: me
* If we've got a full output buffer queue and cannot sendbrian1998-08-251-1/+44
| | | | | | | | anything for two mintues (see ``set choked'' and ``show bundle''), nuke the ip, mp and link level buffer queues. This should fix problems where ``ppp -auto'' seems to stop responding after failing to connect to the peer a few times.
* When entering ``term'' mode, don't output any messages untilbrian1998-08-091-1/+3
| | | | | | | 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-2/+3
| | | | | | | | | | | | | | (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.
* On receipt of a sig 15, do a full bundle_Close() even ifbrian1998-08-021-4/+1
| | | | | our current phase is PHASE_DEAD as it's possible that there are links stuck in OPENING waiting for a redial timer.
* Allow an optional ``!'' in the open, dial & call commands.brian1998-07-291-5/+10
| | | | | When used, the redial timer is ignored and the modem is opened immediately.
* Silence ``Network unreachable'' warnings when usingbrian1998-07-281-7/+8
| | | | | | | | | | | | | | | | | | ``add .... HISADDR''. The network will never be reachable at this point unless we're in -auto or reading the command from ppp.linkup. We can now run the following lines and get the expected results: set ifaddr 1.2.3.4/0 5.6.7.8/0 add default HISADDR where a route is added immediately in auto mode and the whole thing is delayed 'till the IP numbers have been agreed in other modes. Essentially, ppp.linkup is no longer required.
* Remove redundant includesbrian1998-06-271-3/+1
|
* Don't dlopen()/dlsym() libalias, use it in the same waybrian1998-06-271-5/+9
| | | | as the rest of the world uses libraries.
* Cast void * to char * for log_Printf().brian1998-06-271-2/+2
|
* ``struct tunnel_header'' -> u_int32_t in OpenBSD.brian1998-06-271-2/+1
| | | | | | struct tunnel_header is going soon. Suggested by: Theo
* o If we come out of select() with only write descriptors thatbrian1998-06-241-3/+6
| | | | | | | | | | | 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.
* Re-initialise our timer service after fork()ingbrian1998-06-201-1/+2
| | | | | | to lose our terminal session. Is this a bug in setitimer() ? - it must be called again in the child !
* Create & use fsm2initial(), a function to bring abrian1998-06-201-16/+6
| | | | | state machine back to ST_INITIAL without going through any unnecessary TLS/TLF pairs.
* Make sure our recvmsg() is a SCM_RIGHTS message whenbrian1998-06-181-11/+11
| | | | we receive a link from another ppp.
* Change some log levels. ALERTs are only logged whenbrian1998-06-161-14/+12
| | | | | | something that can't happen happens or when everyone needs to know. ERRORs are only logged when something unexpected happens.
* Don't bring the modem offline or hangup when ``down lcp''brian1998-06-161-3/+3
| | | | is done. Instead, behave like ``close lcp''.
* 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.
* Make `close lcp' just close the LCP layer and not hangup. This isbrian1998-06-151-10/+16
| | | | | | 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-55/+77
| | | | | | | | | | | 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>
* Update the write descriptor selection set for our data linksbrian1998-06-071-3/+5
| | | | | | | *after* shuffling fragments from the IP queue into the individual link queues. This fixes a latency problem pointed out by: Bruce Evans <bde@zeta.org.au>
OpenPOWER on IntegriCloud