summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r261900brueffer2014-02-211-0/+5
| | | | | | | | | In chat_UpdateSet(), initialize the input buffer to prevent stale data from previous timed out commands. PR: 186530 Submitted by: Alexander Zagrebin <alexz at visp.ru> Reviewed by: brian
* Add a bunch of malloc() return checksbrian2004-10-111-3/+4
| | | | | PR: 71592 Submitted by: Dan Lukes <dan@obluda.cz> with further changes
* Make ppp WARNS=5 cleanbrian2004-09-051-3/+5
|
* Remove whitespace at the end of lines.brian2002-06-151-2/+2
|
* o Clean up some #includesbrian2002-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>
* Merge the NETGRAPH branch into HEAD. tty devices now use netgraph's linebrian2002-03-301-3/+5
| | | | | | | | 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.
* Add a ``log'' command for logging specific information.brian2001-11-031-2/+2
| | | | | | | | | | | | | | 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)
* o Add ipv6 support, abstracting most NCP addresses into opaquebrian2001-08-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | structures (well, they're treated as opaque). It's now possible to manage IPv6 interface addresses and routing table entries and to filter IPV6 traffic whether encapsulated or not. IPV6CP support is crude for now, and hasn't been tested against any other implementations. RADIUS and IPv6 are independent of eachother for now. ppp.linkup/ppp.linkdown aren't currently used by IPV6CP o Understand all protocols(5) in filter rules rather than only a select few. o Allow a mask specification for the ``delete'' command. It's now possible to specifically delete one of two conflicting routes. o When creating and deleting proxy arp entries, do it for all IPv4 interface addresses rather than doing it just for the ``current'' peer address. o When iface-alias isn't in effect, don't blow away manually (via ``iface add'') added interface addresses. o When listening on a tcp server (diagnostic) socket, bind so that a tcp46 socket is created -- allowing both IPv4 and IPv6 connections. o When displaying ICMP traffic, don't display the icmp type twice. When display traffic, display at least some information about unrecognised traffic. o Bump version Inspired after filtering work by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
* Make -DNOSUID (or -DPPP_NOSUID) possible to build ppp without SUIDbrian2000-08-181-0/+2
| | | | capabilities.
* Allow leading ``!'' characters in authkeys and chat scripts tobrian2000-08-091-4/+5
| | | | be doubled up to mean a single literaly ``!''.
* To avoid namespace polution in NetBSD:brian2000-03-141-4/+4
| | | | ``struct descriptor'' -> ``struct fdescriptor''
* Add a few missing #includesbrian1999-12-301-0/+1
|
* Correct usages of getuid() and geteuid()brian1999-12-301-1/+1
| | | | Pointed out by: billf
* Don't allowt '#' as a comment when it's embedded in quotes:brian1999-12-271-2/+3
| | | | | | | | set something "xxx yyy # zzz" aaa shouldn't be interpreted as set something "xxx yyy" aaa
* Don't munge ``set dial|login|logout|hangup'' arguments beforebrian1999-12-221-2/+2
| | | | ExpandString() has a chance to do its own substitutions.
* Notice and warn about unterminated quoted strings in commands.brian1999-12-201-3/+10
| | | | The entire command is ignored if the syntax is invalid...
* Be careful not to re-initialise `struct stat' while it still hasbrian1999-12-031-8/+23
| | | | | | a running timer. This fixes a problem where a dial is manually aborted, the hangup script kicks in and the chat timer ends up on the timer queue twice (tick tick tick tick *boom*)
* Introduce ``set logout''; another chat script. This is in preparationbrian1999-10-251-2/+2
| | | | for the abstraction of ``set dial'' and ``set hangup''.
* Back out the bogus #ifdef __NetBSD__ #include <signal.h> lines.brian1999-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>
* NetBSD has moved ``extern int errno;'' to signal.h :-/brian1999-09-201-0/+3
| | | | Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Set the close-on-exec flag for all unused descriptors whenbrian1999-08-171-9/+10
| | | | exec()ing other programs.
* Don't bother read()ing if we ``expect'' nothing in our chat script.brian1999-06-261-2/+2
|
* If we run out of chat script immediately after a successfully executedbrian1999-06-261-2/+6
| | | | | | | expect-send-expect sequence, finish gracefully, don't core dump. This bug has been there for over a year - I could never reproduce it ! Straw provided by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
* Use the correct pid when substituting PROCESSID.brian1999-06-091-2/+2
| | | | Problem reported by: Amedeo Beck Peccoz <gea@gressoney.it>
* Add some comments, optimise out a few strlen()s andbrian1999-05-271-16/+23
| | | | remove a few extraneous assignments.
* o Redesign the layering mechanism and make the aliasing code part ofbrian1999-05-081-60/+5
| | | | | | | | | | | | | | | | | | | | | 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''.
* When executing a command as part of a dial/login/hangupbrian1999-02-121-6/+9
| | | | script, expand words in the same way as !bg does.
* Initial RADIUS support (using libradius). See the man page forbrian1999-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
* Untimeout the chat expect timer as soon as we get abrian1998-10-271-1/+2
| | | | | | match - otherwise, with a delayed (\\d) ``send'', the timeout may happen during the send and cause a failure. Problem reported by: David L. Vondrasek <dallas.tx@airmail.net>
* o Support callback types NONE, E.164, AUTH and CBCP.brian1998-08-071-4/+7
| | | | | | | | | | | | | | (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.
* Remove redundant includesbrian1998-06-271-2/+1
|
* o If we come out of select() with only write descriptors thatbrian1998-06-241-2/+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.
* o De-staticise things that don't need to be static.brian1998-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.
* o #define the name "tun" in defs.h against the future possibilitybrian1998-05-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | of supporting architectures with different device names. o Close /dev/tunX when destroying the bundle. o Don't forget to close the parent end of the pipe in the child process when exec'ing a program from a chat script. o If we close our controlling terminal, ditch the current session with it, allowing getty(8) (or whatever) to regain control. o After transferring our controlling terminal descriptor to another ppp instance, we now fork a new ppp to continue where we left off, transferring ownership of all uucp locks and the /var/run/tunX.pid file. Meanwhile the parent closes all file descriptors, defaults all signals and does a pause() to wait for a HUP after the transferred descriptor is finally closed. We don't run /bin/cat any more (again!). Suggested by: bde TODO: It seems clocal devices need their pause()d session leader to be given a manual HUP, as closing the last open descriptor doesn't do the job.
* o Move our prompt descriptor list outside of the bundle.brian1998-05-231-2/+1
| | | | | | | | | | | | | | | | | | | | 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-458/+572
| | | | See the file README.changes, and re-read the man page.
* Remove unused #includes.brian1998-01-211-4/+1
| | | | | | Make various bits static. Remove unused variables. Submitted by: eivind
* Allow (and document) execution of commands from withinbrian1997-12-271-85/+124
| | | | | our chat script. You can now even run chat(8) - see ppp.conf.sample.
* Cosmetic (style):brian1997-12-241-8/+8
| | | | | | | sizeof(var) -> sizeof var sizeof type -> sizeof(type) Suggested by: J Wunsch <j@uriah.heep.sax.de>
* strncpy(x,y,sizeof(x)) --> strncpy(x,y,sizeof(x)-1)brian1997-12-231-2/+2
| | | | | Suggested by: Philippe Charnier <charnier@lirmm.fr> Theo de Raadt <deraadt@cvs.openbsd.org>
* Replacebrian1997-12-181-2/+3
| | | | | | | | | | | | | strcpy(a, b); /* a and b are the same size */ with strncpy(a, b, sizeof(a)); a[sizeof(a)-1] = '\0'; Making the code `correct at a glance'. Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>
* Fix prototypes.brian1997-11-221-22/+23
| | | | | | | | | | | | | | 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).
* Increase chat script sizes to 512brian1997-11-091-4/+4
| | | | Requested by: Michael Reifenberger <root@totum.plaut.de>
* Introduce ID0 logging.brian1997-11-091-10/+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.
* o Bump version to 1.3 to reflect major changesbrian1997-10-291-4/+1
| | | | | | | | | | | | 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 (no functional changes):brian1997-10-261-28/+37
| | | | | | | | | | | | | | | 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
* sleep => nointr_sleepbrian1997-10-241-3/+3
| | | | | | usleep => nointr_usleep (not just a #define) Already done by: ache
* Cosmetic: Make LogPrintf() calls consistent.brian1997-08-311-26/+26
|
* Make the code format more in line with style(9).brian1997-08-251-75/+96
| | | | | Update loadalias to use the new libalias api. Update to version 1.1.
OpenPOWER on IntegriCloud