aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/defs.c
Commit message (Collapse)AuthorAgeFilesLines
* Make ppp WARNS=5 cleanBrian Somers2004-09-051-8/+15
| | | | Notes: svn path=/head/; revision=134789
* o Clean up some #includesBrian Somers2002-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> Notes: svn path=/head/; revision=96582
* When it's necessary to kldload tun(4), don't forget to re-try to openBrian Somers2002-04-151-4/+10
| | | | | | | | | tun0. Submitted by: qhwt@myrealbox.com Notes: svn path=/head/; revision=94698
* Merge the NETGRAPH branch into HEAD. tty devices now use netgraph's lineBrian Somers2002-03-301-1/+27
| | | | | | | | | | | discipline to do the async escaping, but no other benefits are available yet. Change ``ifdef HAVE_DES'' to ``ifndef NODES'' for consistency. Make the Makefile a little more sane WRT RELEASE_CRUNCH. Notes: svn path=/head/; revision=93418
* Handle B460800 and B921600 being defined in <termios.h>Brian Somers2002-03-121-0/+6
| | | | Notes: svn path=/head/; revision=92142
* Add a ``log'' command for logging specific information.Brian Somers2001-11-031-0/+17
| | | | | | | | | | | | | | | | | Add an ``UPTIME'' variable to indicate the bundle uptime. It's now possible to put something like this in ppp.linkdown for a server setup: MYADDR: log Session closing: User USER, address HISADDR, up UPTIME Fixed some memory leakage with commands that expand words. Made some functions static. Fixed a diagnostic bug (iface add .... SIOCDIFADDR) Notes: svn path=/head/; revision=85991
* Correct the arg count after parsing a line with an unescaped # that isn'tBrian Somers2001-06-151-3/+2
| | | | | | | | | preceeded with whitespace. MFC after: 3 weeks Notes: svn path=/head/; revision=78275
* Ignore ``#'' properly when told toBrian Somers2000-10-281-1/+1
| | | | Notes: svn path=/head/; revision=67825
* Create fd_sets big enough to handle getdtablesize() descriptors.Brian Somers2000-10-091-0/+12
| | | | Notes: svn path=/head/; revision=66898
* libutil.h is no longer required for setproctitle()Brian Somers2000-09-021-5/+0
| | | | Notes: svn path=/head/; revision=65355
* Use arc4random() instead of random()Brian Somers2000-08-311-1/+3
| | | | Notes: svn path=/head/; revision=65269
* Don't treat two or more whitespace followed by a comment asBrian Somers2000-08-301-6/+11
| | | | | | | | | | an empty argument PR: 20937 (maybe) PR: 20938 Notes: svn path=/head/; revision=65264
* Use srandom() under OpenBSDBrian Somers2000-08-291-1/+1
| | | | | | | Submitted by: Matt Behrens <matt@megaweapon.zigg.com> Notes: svn path=/head/; revision=65210
* setproctitle() doesn't need to be called with root privs, so moveBrian Somers2000-08-161-0/+16
| | | | | | | it from id.c into defs.c Notes: svn path=/head/; revision=64698
* When running ppp -background, show comfort messages showingBrian Somers2000-04-071-0/+16
| | | | | | | | | | | when we're redialing/reconnecting. While we're here, log redial, reconnect and phone number announcements to LogCHAT, and reduce some other logging to LogDEBUG. Notes: svn path=/head/; revision=59084
* don't treat # specially if PARSE_NOHASH is passedBrian Somers2000-03-281-2/+2
| | | | Notes: svn path=/head/; revision=58745
* When ppp can't identify the relevant name, don't use "???", useBrian Somers2000-03-141-0/+27
| | | | | | | <nnn> or <0xxxx> instead. Notes: svn path=/head/; revision=58034
* Actually ignore comments at the end of lines - broken with the commitBrian Somers2000-01-271-1/+1
| | | | | | | that made ppp *not* treat #s in quoted arguments as comments. Notes: svn path=/head/; revision=56655
* Don't allowt '#' as a comment when it's embedded in quotes:Brian Somers1999-12-271-5/+6
| | | | | | | | | | | set something "xxx yyy # zzz" aaa shouldn't be interpreted as set something "xxx yyy" aaa Notes: svn path=/head/; revision=55145
* Understand double-quotes anywhere on a command line in the sameBrian Somers1999-12-231-16/+12
| | | | | | | | way that a shell does. The previous way ppp did it just didn't make any sense. Notes: svn path=/head/; revision=55065
* Don't munge ``set dial|login|logout|hangup'' arguments beforeBrian Somers1999-12-221-6/+9
| | | | | | | ExpandString() has a chance to do its own substitutions. Notes: svn path=/head/; revision=55013
* Handle comments at the end of lines.Brian Somers1999-12-201-19/+13
| | | | Notes: svn path=/head/; revision=54915
* Notice and warn about unterminated quoted strings in commands.Brian Somers1999-12-201-1/+4
| | | | | | | The entire command is ignored if the syntax is invalid... Notes: svn path=/head/; revision=54914
* Make -foreground a proper option (allowing ``allow mode foreground'',Brian Somers1999-11-281-0/+1
| | | | | | | ``set mode foreground'' etc. Notes: svn path=/head/; revision=53830
* Back out the bogus #ifdef __NetBSD__ #include <signal.h> lines.Brian Somers1999-09-211-3/+0
| | | | | | | | | | The original report was due to a mis-installation of the NetBS header files :-/ Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp> Notes: svn path=/head/; revision=51517
* NetBSD has moved ``extern int errno;'' to signal.h :-/Brian Somers1999-09-201-0/+3
| | | | | | | Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp> Notes: svn path=/head/; revision=51449
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50479
* Handle unterminated quoted strings without dup'ing the last characterBrian Somers1999-05-271-3/+3
| | | | | | | with an out-by-one-memcpy. Notes: svn path=/head/; revision=47551
* o Redesign the layering mechanism and make the aliasing code part ofBrian Somers1999-05-081-1/+167
| | | | | | | | | | | | | | | | | | | | | | | | 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
* #include <errno.h>, not <sys/errno.h>Brian Somers1999-04-261-2/+2
| | | | Notes: svn path=/head/; revision=46085
* Parse IP addresses more securely - specifically, don't allowBrian Somers1999-02-251-1/+38
| | | | | | | | | | | a bum name to return as 0.0.0.0... we don't want ``delete xxx'' to delete the default route when xxx doesn't resolve. Support IP number specifications as the host when specifying a tcp-style device (rather than *just* hostnames). Notes: svn path=/head/; revision=44279
* Remove redundant includesBrian Somers1998-06-271-1/+3
| | | | Notes: svn path=/head/; revision=37192
* 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 Make modes consistent throughout ppp. The same strings are usedBrian Somers1998-05-291-5/+5
| | | | | | | | | | | | | | | | | | 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> Notes: svn path=/head/; revision=36465
* srandomdev() isn't available in all 2.* versions. OnlyBrian Somers1998-05-291-2/+2
| | | | | | | use it for version 3 (-current) & up. Notes: svn path=/head/; revision=36453
* MFMP: Make ppp multilink capable.Brian Somers1998-05-211-61/+58
|\ | | | | | | | | | | | | See the file README.changes, and re-read the man page. Notes: svn path=/head/; revision=36285
| * o Add the `set mode' command for change a links current mode. ItBrian Somers1998-05-151-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Make sure we don't dereference NULL when we've lost all our links.Brian Somers1998-05-061-3/+3
| | | | | | | | | | | | | | | | | | 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 Create a new ``timer'' log level. This lets us ``setBrian Somers1998-04-301-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Negotiate MRRU, SHORTSEQ and ENDDISC. ENDDISC doesn't implyBrian Somers1998-04-231-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
| * o Remove the `mode' global - it's now per physical device.Brian Somers1998-04-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 unused includes.Brian Somers1998-04-061-10/+1
| | | | | | | | Notes: svn path=/cvs2svn/branches/MP/; revision=35059
| * Deglobalise `struct prompt':Brian Somers1998-04-031-18/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Our diagnostic socket has its password set in the `set socket' line only (not in ppp.secret). o Passwords are per server socket (*VarAuthKey are gone) o Authority is per prompt (VarLocalAuth is gone). o Local logging is per prompt. o Add a `show who' command to see who's connected. No identd routine - just a `where the connection came from' display. o SIGUSR1 is disabled for now - we have no way of choosing a password for the socket created :-( Prompts are attached as a list of `struct descriptor's in struct bundle, and serviced under the bundles descriptor service routines. Ultimately, everything should be done like this. Cosmetic: o alphabeticalise SRCS in Makefile. o Add a few comments in command.h TODO: Start checking that we don't overflow the descriptor sets in select() now that we can have any number of descriptors. Notes: svn path=/cvs2svn/branches/MP/; revision=35016
| * Tidy up the parent notification stuff for -background mode.Brian Somers1998-03-251-3/+1
| | | | | | | | | | | | | | Remove extraneous extern decls of tun_{in,out} and netfd. Notes: svn path=/cvs2svn/branches/MP/; revision=34888
| * Remove some more globals:Brian Somers1998-03-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | o int modem was unused. o StateNames[] is now accessed via State2Nam() o ipKeepAlive is no more. As a result, we must call FilterCheck() twice if we're doing TCP/IP logging (once when we queue and log the packet and once when we transmit it and need to know if the idle timer should be reset), but this won't be the case in normal life. Notes: svn path=/cvs2svn/branches/MP/; revision=34883
| * Move the terminal/diagnostic socket stuff out of main.cBrian Somers1998-02-101-19/+1
| | | | | | | | | | | | | | | | and into the new `prompt.c'. struct prompt is (of course) a `sort' of descriptor. Notes: svn path=/cvs2svn/branches/MP/; revision=33209
| * Create `struct bundle' - the top level control structure.Brian Somers1998-02-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | This structure will eventually contain a list of NCPs (currently only IPCP is supported) and a list of physical `struct link's. It will also derive from a struct link itself. Make ModemTimeout() static - it's way to dangerous to be called from outside ! Bump version to 1.9. Our first MP release should be 2.0. Notes: svn path=/cvs2svn/branches/MP/; revision=33029
| * o Move in_algorithm and out_algorithm into CcpInfo.Brian Somers1998-01-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | o Take note of the return value of the compression layers init routine, and if it fails, bring the whole layer cleanly back down again. o Only use srandomdev() if ``__FreeBSD__ > 2'' - this makes these sources buildable on 2.2 (where I'm testing). Notes: svn path=/cvs2svn/branches/MP/; revision=32877
| * This commit was manufactured by cvs2svn to create branch 'MP'.cvs2svn1998-01-291-0/+116
| | | | Notes: svn path=/cvs2svn/branches/MP/; revision=32861
* Correct #ifdef for __FreeBSD__ < 3Brian Somers1998-03-131-2/+3
| | | | Notes: svn path=/head/; revision=34539