aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/bundle.c
Commit message (Collapse)AuthorAgeFilesLines
...
* o Make sure we adjust our min seq and process any outstanding queuedBrian Somers1998-05-231-3/+15
| | | | | | | | | | | incoming fragments when a link goes down. o Don't use the minimum sequence numbers of links that aren't open. o Understand sequence number wrapping when determining the minimum sequence number. o Add & adjust a few comments. Notes: svn path=/head/; revision=36312
* MFMP: Make ppp multilink capable.Brian Somers1998-05-211-1/+1
| | | | | | | See the file README.changes, and re-read the man page. Notes: svn path=/head/; revision=36285
* o Add `set autoload'. You can now set the minimum and maximumBrian Somers1998-05-211-70/+252
| | | | | | | | | | | | | | thresholds (in terms of queued packets for a period of time) where -auto links will be brought up and down. By default, all auto links come up when we reach NETWORK phase and never go down. o Display current autoload state in `show bundle'. o Disable the idle timer as soon as it's called. o Disable the idle and autoload timers when exiting (in case we're abending). Notes: svn path=/cvs2svn/branches/MP/; revision=36268
* Don't bring the interface down with the last link when we'reBrian Somers1998-05-191-2/+3
| | | | | | | in -auto mode (broken a few commits ago). Notes: svn path=/cvs2svn/branches/MP/; revision=36233
* Close some file descriptors.Brian Somers1998-05-191-1/+4
| | | | | | | Pointed at by: Ruslan Ermilov <ru@ucb.crimea.ua> Notes: svn path=/cvs2svn/branches/MP/; revision=36228
* Check the MP server in bundle_IsSet().Brian Somers1998-05-171-1/+4
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=36118
* Add the `rename' command for renaming links.Brian Somers1998-05-161-1/+18
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=36113
* o Add the `set mode' command for change a links current mode. ItBrian Somers1998-05-151-1/+33
| | | | | | | | | | | | | | | | is not possible to switch to or from dedicated or direct mode, but all other combinations are ok (eg. -auto -> -ddial). o Cope with the fact that commands with optional context may not be able to obtain a link with command_ChooseLink() (if all links have been deleted for example). o Allow `clone'ing in non-multilink mode. We may for example want to configure two links in unilink mode and dial them both, using the one that comes up first. It's also possible to rename ``deflink'' by cloning it, deleting the original, then setting the mode of the new link. Notes: svn path=/cvs2svn/branches/MP/; revision=36088
* o Call bundle_LinkClosed() when transferring a datalink so thatBrian Somers1998-05-151-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | the bundle has the opportunity to go PHASE_DEAD and cleanup the interface (if it's the last link). o Regnerate our phys_type value when we transfer the link. o Always clean up the interface when destroying our bundle in case we're abending. o Always clean up our interface when the last link is gone rather than delaying things 'till exit time in the -direct case (the interface is useless anyway). Do this *after* slamming down our NCPs (if they're still around). o Our MP server descriptor now clears the relevent device descriptor from our descriptor [fd]sets when a datalink is on death-row (to be transferred to another running ppp), thus avoiding the possibility of passing a bum descriptor to select() and having ppp abend. o Handle the MP socket descriptor functions from within the bundle descriptor functions. Now we ensure that the MP socket descriptor functions see the descriptor sets *after* they've been seen by our datalinks. o Add/fix a few more comments. Notes: svn path=/cvs2svn/branches/MP/; revision=36076
* o Do an mp_Down() when aborting ppp.Brian Somers1998-05-111-1/+4
| | | | | | | | o Re-assign the link name when strdup()ing the datalink name. o Add the link name to some more hdlc log messages. Notes: svn path=/cvs2svn/branches/MP/; revision=35956
* o Protect against expected NULL fdset pointers.Brian Somers1998-05-101-2/+3
| | | | | | | | | | | | | o Log FD_SET()s in LogTIMER. o Identify the descriptor that causes an EBADF from select() if LogTIMER is enabled (then exit). o Call the MP server UpdateSet() function after calling the UpdateSet() for all links - the link may enter PHASE_TERMINATE and bring down the MP server - breaking the imminent select(). Notes: svn path=/cvs2svn/branches/MP/; revision=35924
* Don't `clone' links with existing names.Brian Somers1998-05-101-6/+14
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35905
* When transmitting link file descriptors in multilink mode, ACKBrian Somers1998-05-091-2/+6
| | | | | | | | our received file descriptor, and don't close a sent descriptor 'till the ack has been received. Notes: svn path=/cvs2svn/branches/MP/; revision=35896
* Log datalink state transitions consistently.Brian Somers1998-05-091-3/+1
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35895
* o Rename datalinks as soon as the name has been received so thatBrian Somers1998-05-081-28/+8
| | | | | | | | | | | | | | | | | | | | | | | | | LQM and HDLC timer diagnostics come out with the correct name. o Don't send an LQR immediately upon reviving a datalink. Leave it 'till the next timeout. o Add the link name to some more LQR diagnostics. o Break out of the main loop when a descriptor exception is seen in select(). o Remove the evil nointr_[u]sleep() functions. Timers should be (and are) used instead. o Treat a read() of 0 bytes as an error that's fatal to the link on which the read() is done. We should never read() 0 after select() says there's something there - not unless the link has been closed by the other side. o Write the data seen before a HDLC header to the terminal in `term' mode, *not* back to the modem :-/ o Initialise our transmitted file descriptor before starting any timers. o Only send data links that have *no* pending output data. This means that our final ACK will be written rather than being nuked with the datalink transmission. Notes: svn path=/cvs2svn/branches/MP/; revision=35834
* Categorize the fields in struct bundle, and make the tunnelBrian Somers1998-05-061-52/+57
| | | | | | | device speed available in ``show bundle''. Notes: svn path=/cvs2svn/branches/MP/; revision=35818
* Log link name changes correctly.Brian Somers1998-05-061-3/+14
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35816
* o Make sure we don't dereference NULL when we've lost all our links.Brian Somers1998-05-061-7/+23
| | | | | | | | | o Use srandomdev() for __FreeBSD__ >= 2, not just >2. o Use srandom((time(NULL)^getpid())+random()), random() when we haven't got srandomdev(). Notes: svn path=/cvs2svn/branches/MP/; revision=35791
* o Don't enter phase TERMINATE in the LCP TLD, leave it exclusivelyBrian Somers1998-05-061-15/+93
| | | | | | | | | | for the last NCP TLF. o Move tun reading from the main loop into the bundle descriptor handling routines. o Cosmetic: Add a few `const's and make some diagnostics clearer. Notes: svn path=/cvs2svn/branches/MP/; revision=35790
* Create `struct sticky_route'.Brian Somers1998-05-051-17/+25
| | | | | | | | | | | | | | | Any `add' or `delete' command that uses MYADDR or HISADDR will be added to the sticky route list (show ipcp). When MYADDR or HISADDR change due to IPCP negotiations, and if `sroutes' is enabled (the default), all sticky route entries are updated in the routing table. The end result is that `add default hisaddr' will ``stick'', as will ``add myaddr 255.255.255.255 127.0.0.1'' and ``add 1.2.3.4 255.255.255.0 hisaddr''. Notes: svn path=/cvs2svn/branches/MP/; revision=35763
* o Use a tun speed of 115200 for each network link.Brian Somers1998-05-051-4/+6
| | | | | | | | o Display the link weight in `show links', and only show throughput for open links. Notes: svn path=/cvs2svn/branches/MP/; revision=35730
* o Display current link throughput in `show links' (assumingBrian Somers1998-05-031-3/+8
| | | | | | | | | | | | | | throughput measurement is enabled). o Load balance the links based on weight *and* on a round-robin basis. This makes things fairly even on an output basis. We don't try to allow for the peer sending all his data down one link (and try to send ours back up the other). o Show the number of pending input buffers that can't be processed in ``show mp''. o Fix a typo in the man page. Notes: svn path=/cvs2svn/branches/MP/; revision=35653
* o Transfer file descriptors using {send,recv}msg & SCM_RIGHTS,Brian Somers1998-05-021-102/+99
| | | | | | | | | | | | | | | using the scatter/gather array to transfer the link information. The whole link is now passed in one message. This is far better than the two `/bin/cat' processes per additional link :-) I remember years ago thinking that file descriptor transferral would be a really amazing facility ! Suggested by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> and: Eivind Eklund <eivind@yes.no> Notes: svn path=/cvs2svn/branches/MP/; revision=35627
* Cosmetic: Make our external function names consistent.Brian Somers1998-05-011-63/+63
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35605
* o Explicitly set the close-on-exec flag of descriptor 3 beforeBrian Somers1998-05-011-1/+2
| | | | | | | | | | | | | | | exec()ing. Tidy up file dups in general prior to exec(). This prevents our tun device (fd 3) from staying open (and configured) despite handing off all it's links and exiting (because ``cat'' holds it open). o Don't bother SIG_DFL'ing signals before exec() as they're already trapped with specific handlers and will be handled correctly by the exec. o Use values from paths.h for "/dev/" and "/dev/tty". o Don't assert() in physical.c. Notes: svn path=/cvs2svn/branches/MP/; revision=35603
* o Use two `cat' processes to connect the modem to anBrian Somers1998-05-011-20/+44
| | | | | | | | | | | already-running ppp. Suggested by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> o Use _PATH_DEVNULL rather than "/dev/null" o Be more paranoid about nuking running timers when transferring links. Notes: svn path=/cvs2svn/branches/MP/; revision=35601
* o Create a new ``timer'' log level. This lets us ``setBrian Somers1998-04-301-19/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | log debug'' without filling our filesystem/screen with junk that we don't really want to see. o change PHYS_STDIN to PHYS_DIRECT - we can handle incoming connections that aren't on STDIN_FILENO now. o Allow return values from our FSM LayerUp functions. If LayerUp() fails, the FSM does an immediate FsmDown() without calling the fsm_parent's Layer{Up,Down} functions. o Clear the close-on-exec flag of file descriptor 3 when executing chat programs so that our documented ability to communicate with /dev/tty via that descriptor works. Also document it as descriptor 3, not 4 :-O o Allow a ``rm'' command as an alias for ``remove''. o Fix the bind()/connect()/accept() calls made by the MP server. o Create bundle_SendDatalink() and bundle_ReceiveDatalink(). This allows `struct datalink's to flatten themselves, pass through a pipe (read: the eye of a needle !) and come alive at the other end. The donator then fork()s & exec()s pppmpipe, ``passing'' the connection to another ppp instance. *** PPP NOW TALKS MULTILINK :-))) *** Our link utilization is hideous, and lots of code needs tidying still. It's also probably riddled with bugs ! It's been tested against itself only, and has hung once, so confidence isn't high.... Notes: svn path=/cvs2svn/branches/MP/; revision=35568
* o Add the link name to modem diagnostics.Brian Somers1998-04-281-1/+16
| | | | | | | | | | | | | | | | | 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 Don't limit our tun device number to 256. As long as there'sBrian Somers1998-04-271-15/+8
| | | | | | | | another /dev/ entry, keep trying to open them. o Don't allow ``open ccp'' if lcp isn't open. Notes: svn path=/cvs2svn/branches/MP/; revision=35471
* Make gcc-2.8.1 build ppp cleanly.Brian Somers1998-04-251-4/+6
| | | | | | | Support OpenBSD again. Notes: svn path=/cvs2svn/branches/MP/; revision=35451
* o Defer setting up pap/chap based IP numbers & labels until afterBrian Somers1998-04-241-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | we've determined if we're going to join another ppp invocation. o Make ``show link'' show all link details, and ``show links'' just give a list of links and their current status. o Show our current label in ``show bundle''. o Allow link cloning and removal as soon as our MRRU is set. o Make ``show lcp'' require context as nothing will ever change in our MP LCP (it's auto-configured as per rfc1990). o Initialise our LQM owner in hdlc_Init(). o Store our endpoint discriminator and authentication name at both the datalink and multilink level and compare them when we've finished AUTHENTICATE phase and before entering NETWORK phase. If they don't match, close the link again. Display the information in the appropriate ``show'' command. o Initialise datalink::phone and datalink::fsmp.object properly when we're cloning the link. o Show which link we're passing LQRs on in our diagnostics. o Reject endpoint discriminator REQs at the logical multilink level. o Remove the rest of our CARRIER and LINK logging setup. Notes: svn path=/cvs2svn/branches/MP/; revision=35432
* o Remove LINK level logging.Brian Somers1998-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | o change the default link name to ``deflink'' rather than ``default''. o Prepend the link name to CCP and LCP FSM diagnostics. o Protect against 0 length options in CCP and IPCP REQ interpreters (already done for LCP). o Allow optional context for the `show' command. o Use MPs link when interpreting commands if the multilink mrru is configured rather than when multilink is active. This means that once we've ``set mrru xxx'', we then need to ``link deflink show ccp'' etc if we want to do link-level stuff (based on the command requiring optional or manditory context). o Use the ifconfig'd interface address in `set enddisc {ip,mac}' if it's there, otherwise the configuration file value. Notes: svn path=/cvs2svn/branches/MP/; revision=35431
* o Initialise MP correctly depending on if we're theBrian Somers1998-04-231-3/+5
| | | | | | | | | | | | | | | | first link in mp_Up(). o Bring MP and its CCP down when we enter phase TERMINATE, and ditch everything in the incoming packet queue. o Enable MRRU negotiation. Now, we can multilink mode, but only with one physical link. o Close the link if the peer PROTO REJs PROTO_MP. o Prepend our protocol before passing a packet to struct mp for fragmentation. o Log info messages to DEBUG, not ERROR (oops). o Align `show mp' output (again). Notes: svn path=/cvs2svn/branches/MP/; revision=35410
* o Add ipcp_SetLink() for attaching IPCP to the correct link, andBrian Somers1998-04-231-4/+6
| | | | | | | | | | | call it after link authentication. o Pretty print our bundle MTU. o Correct MP header encoding and decoding (should be network byte order). o Add some debug diagnostics so that we can see MP fragment sending and re-assembly. Notes: svn path=/cvs2svn/branches/MP/; revision=35406
* Negotiate MRRU, SHORTSEQ and ENDDISC. ENDDISC doesn't implyBrian Somers1998-04-231-5/+28
| | | | | | | | | | | | multilink ('cos I've seen my ISP REQ it without multilink). Setting MRRU is ifdef'd out until it's debugged and we can merge -direct links with other running programs. Fix MTU setting. Notes: svn path=/cvs2svn/branches/MP/; revision=35397
* Indent Auth name properly.Brian Somers1998-04-201-2/+2
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35321
* o Use __attribute__ (#ifdef __GNUC__) to type-checkBrian Somers1998-04-191-2/+2
| | | | | | | | LogPrintf() and prompt_Printf(), and fix the bits identified as being wrong as a result. Notes: svn path=/cvs2svn/branches/MP/; revision=35317
* Tidy up the use of struct pppTimer.Brian Somers1998-04-191-2/+1
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35297
* Destroy struct chat when it's finished in struct datalink.Brian Somers1998-04-181-2/+2
| | | | | | | | Initialise chat timers correctly as they're malloc()ed as part of struct datalink, and initially contain garbage. Notes: svn path=/cvs2svn/branches/MP/; revision=35276
* Support client side DNS server negotiation, disabledBrian Somers1998-04-171-3/+1
| | | | | | | | | | | | | | | | | | and denied by default (POLA). o Remove ``enable'' msext. Now, doing a ``set nbns'' will automatically enable a NBNS ACK/NAK rather than a REJ. o Add accept|disable|deny|enable dns. If we ``accept'', we'll tell the peer what our nameservers are (if he asks). The values in resolv.conf can be overridden with the ``set dns'' command. If we ``enable'', we'll REQ using our resolv.conf entries, and any NAKs are written back to resolv.conf. o Remove ``show msext'' and show the relevent IP numbers in ``show ipcp''. Notes: svn path=/cvs2svn/branches/MP/; revision=35255
* o Remove bundle_LinkLost() and have the modem routines simplyBrian Somers1998-04-171-20/+1
| | | | | | | | | | | | | | | call datalink_Down() where appropriate rather than modem_Hangup(). o Now, when something horrible happens (failed read/write, loss of carrier etc), we go offline and run any hangup scripts etc in a controlled manner - exactly the same as if someone says ``down'' at the prompt or sends us a HUP. o -dedicated links that fail to make the modem raw close it, suffer the redial timeout then try to open it again. o Add a ``carrier lost'' warning diagnostic. Notes: svn path=/cvs2svn/branches/MP/; revision=35254
* Fix the worst sort of bug - a SEGV in a diagnostic !Brian Somers1998-04-161-9/+9
| | | | | | | | Also, use sizeof sockaddr_in instead of 16 when writing to the routing socket. Notes: svn path=/cvs2svn/branches/MP/; revision=35240
* Stop the idle timer if the timeout is disabled whileBrian Somers1998-04-161-10/+11
| | | | | | | the timer is active. Notes: svn path=/cvs2svn/branches/MP/; revision=35239
* o FsmDown() and FsmClose() any NCP that's still around beforeBrian Somers1998-04-161-2/+8
| | | | | | | | going into phase DEAD when the last physical link disappears. o Don't go to phase TERMINATE if we're already phase DEAD. Notes: svn path=/cvs2svn/branches/MP/; revision=35238
* o Move the accept/deny/disable/enable globals either to theBrian Somers1998-04-161-1/+26
| | | | | | | | | | | | | | | | | | | | 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
* Pass all command arguments around with struct cmdargs ratherBrian Somers1998-04-141-2/+2
| | | | | | | | | than incrementing argv and decrementing argc. Now individual functions can determine their caller. This also removes the "prefix" hack in FindExec(). Notes: svn path=/cvs2svn/branches/MP/; revision=35200
* Remove ``show timeout'' and ``show auth'' and add ``show bundle''.Brian Somers1998-04-111-1/+24
| | | | | | | Mention ``show timer'' in the man page. Notes: svn path=/cvs2svn/branches/MP/; revision=35143
* o Remove the `mode' global - it's now per physical device.Brian Somers1998-04-101-24/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Shuffle things that live at the datalink level into ``show link'' rather than ``show modem''. o Make both ``show'' commands prettier and more consistent, and display carrier status, link type and our name in ``show modem''. o Show redial and reconnect information in ``show link'' and remove ``show redial'' and ``show reconnect''. o Down the correct link in bundle_LinkLost(). o Remove stale -direct and -background links at the end of our main loop, not when we know they're going. This prevents unexpected pointer-invalidations... o If we ``set server'' with the same values twice, notice and don't moan about failure. o Record dial script despite our link mode. The mode may be changed later (next mod) :-) We never run scripts in -direct and -dedicated modes. o Make ``set server none'' functional again. o Correct datalink state array so that we don't report an ``unknown'' state. o Pass struct ipcp to IpcpCleanInterface, not struct fsm. o Create TUN_PREFIX define rather than hard-coding in main.c o prompt_TtyInit now handles a NULL prompt for -direct mode rather than having to create one then destroy it uncleanly. o Mention our mode in the "PPP Started" LogPHASE message. o Bring all auto links up when we have something to send. o Remove some redundant Physical_*() functions. o Show which connection is running a command when logging commands. o Initialise throughput uptime correctly. Notes: svn path=/cvs2svn/branches/MP/; revision=35118
* Remove MODE_ALIAS and add AliasEnabled() macro.Brian Somers1998-04-071-1/+7
| | | | | | | Remove IsInteractive(). Notes: svn path=/cvs2svn/branches/MP/; revision=35098
* Initialise bundle::idle::done when the timer's stopped.Brian Somers1998-04-071-1/+2
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35091