summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Log the source of client connections to the diagnostic port.brian1997-12-171-8/+32
| | | | | | | Disallow connections from port numbers <1024 as low port numbers can only really mean trouble (ftp bounces etc.). Discussed at length with: Theo de Raadt <deraadt@cvs.openbsd.org>
* If we've got a descriptor table that's bigger than anbrian1997-12-171-1/+12
| | | | | | | | fd_set, make sure that all descriptors >2 are closed when we start - otherwise we're asking for a dump in FD_SET(). Problem pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
* Allow random IP number allocation to peer.brian1997-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | 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.
* Abstract the CCP layer a level.brian1997-12-031-42/+37
| | | | Add DEFLATE support.
* Fix prototypes.brian1997-11-221-22/+38
| | | | | | | | | | | | | | 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).
* Fix interactive mode so that it doesn't require a passwd (again!).brian1997-11-181-1/+4
|
* DropClient() when read() returns 0 (as it did before).brian1997-11-181-2/+2
|
* Add and use a DropClient() function for closing the diagnostic port.brian1997-11-181-11/+4
| | | | Call DropClient() from Cleanup() too.
* Don't SetLabel() 'till we've done the SelectSystem(). Thisbrian1997-11-171-13/+17
| | | | | | | avoids the situation where we specify label ``x'' on the command line, and label ``x'' has a ``load y'' command embedded in it. When the line comes up, we want to use ``x'' from ppp.linkup, not ``y''.
* Add id strings to tun.[ch].brian1997-11-171-2/+3
| | | | Don't try to open ppp.secret if we're never going to use it.
* Abstract data read from and written to the tun device,brian1997-11-161-3/+17
| | | | | | | | | | | | | | allowing for a possible header on the front of all packets. In OpenBSD, there's a structure containing the address family here. If we're building under OpenBSD, set up the ``flags'' part of struct tuninfo (not there under FreeBSD) so that we config the interface as POINTOPOINT. Prefix prototypes with ``extern'' in os.c for consistency. These changes are cosmetic under FreeBSD, but allow ppp to build & work under OpenBSD (bar the srandomdev() stuff, the inclusing of <net/if_var.h> and some Makefile symantecs).
* Don't run if ppp.conf is writable.brian1997-11-131-1/+17
|
* Log a warning when a -direct invocation is denied.brian1997-11-131-1/+9
|
* Fix command logging (broken with the "allow" command).brian1997-11-131-9/+4
|
* Null commit: The last commit made some warning messages clearer.brian1997-11-131-1/+1
|
* Don't delete interface routes when we do an LcpDown.brian1997-11-131-4/+5
| | | | They'll get deleted in Cleanup().
* Finish the security improvements:brian1997-11-111-46/+46
| | | | | | | | | | | | | | | | | | | 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 create a diagnostic socket by default.brian1997-11-091-6/+17
| | | | | | Allow a password spec on the "set server" command line. Use SIGUSR2 to close the diagnostic socket. Some man page corrections.
* Don't ask for a password if it's specified as empty.brian1997-11-091-2/+2
|
* Increase chat script sizes to 512brian1997-11-091-4/+2
| | | | Requested by: Michael Reifenberger <root@totum.plaut.de>
* Introduce ID0 logging.brian1997-11-091-9/+7
| | | | | | | | 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.
* Don't pass global vars as args.brian1997-11-081-5/+5
| | | | Remove local/global conflicts.
* Introduce [local] to "set log [local] ...". This spitsbrian1997-11-041-5/+12
| | | | | logging out to the screen in terminal mode - should be good for installation problem diagnosis.
* o Bump version to 1.3 to reflect major changesbrian1997-10-291-5/+3
| | | | | | | | | | | | 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-42/+48
| | | | | | | | | | | | | | | 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-6/+6
| | | | | | usleep => nointr_usleep (not just a #define) Already done by: ache
* cosmetic:brian1997-10-161-1/+3
| | | | | | o Log client connection commands when "set log +command" o Don't display PAP password in the log unless we're "set log +debug".
* Support VJ maximum slot identifiers != 15.brian1997-10-071-3/+3
| | | | | | | | | 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.
* Correct the way the uucp lock file and the ttyXX.if lockbrian1997-09-221-22/+13
| | | | | | | file get created. We don't create lock files over non-tty connections, but we *do* create lock files in -direct mode. This leaves us capable of adding utmp/wtmp support for successful pap & chap logins (coming soon).
* It turns out that the following:brian1997-09-211-2/+1
| | | | | | | | | | | | close(1); close(2); x = open(ctermid(NULL), O_RDWR|O_NONBLOCK); close(0) on a tty causes select() to return an exception for descriptor x ! This is the case in RELENG_2_2, but not in 2.2.2. I'm not sure why. Instead of doing the x=open() and close(0), we just do x=0 now. Problem pointed out by: Greg Lehey <grog@lemis.com> Tomi Vainio <tomppa@fidata.fi>
* Don't close(1) in direct mode and then proceed tobrian1997-09-181-3/+4
| | | | | | | | | isatty(1) ! Keep 0 open for this till the modem's been set up by either dup()ing 0 or by opening ctermid(NULL) (if isatty(0)). Discussed problem with: Tomi Vainio <tomppa@fidata.fi> Made it finally dawn on me: Angelo Turetta <ATuretta@stylo.it>
* o Fix two unlikely descriptor leaks.brian1997-09-161-5/+6
| | | | | | | | | o Output the correct device for "show modem" while in -direct mode. o Cosmetic: Moan a bit more when we can't open the [modem] device. o Call OpenModem() in a more "natural" way. o Add some LogDEBUG in OpenModem().
* Install as group ``network''brian1997-09-041-38/+14
| | | | | | | | | | | Insist that uid == 0 for client ppp Disallow client sockets if no password is specified Don't exit on failure to open client socket for listening Allow specification of null local password Use reasonable size (smaller) ``vector''s in auth.c Fix "passwd ..." usage message Insist on "all" as arg to "quit" (if any) Drop client socket connection before Cleanup() when "quit all"
* Cosmetic: Make LogPrintf() calls consistent.brian1997-08-311-7/+7
|
* Remove use of login_progok()brian1997-08-311-9/+1
| | | | Suggested by: guido
* Use login_progok().brian1997-08-271-38/+3
|
* Check the "prog.deny" login.conf capability andbrian1997-08-261-1/+44
| | | | | refuse to run if "ppp" is in the list. Suggested by: "Daniel O'Callaghan" <danny@panda.hilink.com.au>
* Lose a couple of extraneous backslashes.brian1997-08-251-5/+3
|
* Make the code format more in line with style(9).brian1997-08-251-244/+233
| | | | | Update loadalias to use the new libalias api. Update to version 1.1.
* Add "set loopback on|off", defaulting to "on".brian1997-08-211-1/+23
| | | | | | | | | This tells ppp to loopback packets addressed to the ppp interface IP coming *from* the tun device. This means that you can ping the tun interface IP from inside :-)
* Make HUP cause an exit (as it used to), and makebrian1997-07-011-5/+5
| | | | | | | | | | INT cause a hangup - not exiting for -ddial & -auto. HUP must exit because init sends this at system shutdown time (why, I don't know), and we don't want to end up redialing after the HUP (due to another dfilter packet). Pointed out by and discussed with: ache
* Fix HUP handling while dialing.brian1997-06-291-3/+6
| | | | Pointed out by: ache
* Add "set server" to control the server socket.brian1997-06-251-60/+48
| | | | | | | | | | 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
* Fix ~? output in "term" mode.brian1997-06-241-9/+9
| | | | Spotted by: Harry Starr <starr@gccs.com.au>
* o Fix uptime for direct connections.brian1997-06-231-27/+15
| | | | | | | | | | | | o Style police o Make hangup abort the current connection, not necessarily exiting (-auto/-ddial). o Trap HUP and INT during DoChat and abort the connection attempt. This means you can now type "dial" and change your mind with ^C, or HUP the process to stop it dialing. Slapped into doing it by: Chuck Robey <chuckr@glue.umd.edu>
* Handle redial tries correctly under -ddialbrian1997-06-171-10/+11
|
* Set netfd to STDOUT_FILENO rather than STDIN_FILENO.brian1997-06-161-2/+2
|
* Remove call to daemon(). Just call setsid() and closebrian1997-06-161-7/+10
| | | | | any relevent descriptors (0,2,[1]). We've already fork()d. PR: 3874
* Sort out ppp over tcp:brian1997-06-111-13/+31
| | | | | | | | | | o Allow "set var" with no args to blank var (don't req ""). o Zero VarTerm ASAP if not in interactive mode. o Never print anything to stdout in -direct mode. o Count redial when failing to open modem. o Increase device size to 40 characters (for host:port). o Remove missed "if (fd == 0) fd = 1;". o Don't give up on incoming non-terminal connections.
* Overhaul ppp:brian1997-06-091-140/+129
| | | | | | | | | | | | | | | | | | | | | | | | | o Use syslog o Remove references to stdout/stderr (incl perror()) o Introduce VarTerm - the interactive terminal or zero o Allow "set timeout" to affect current session o Change "set debug" to "set log" o Allow "set log [+|-]flag" o Make MSEXT and PASSWDAUTH stuff the default o Move all #ifdef DEBUG stuff into the code - this shouldn't be too much overhead. It's now controlled with "set log +debug" o Add "set log command, debug, tun, warn, error, alert" o Remove cdefs.h, and assume an ansi compiler. o Improve all diagnostic output o Don't trap SIGSEGV o SIGHUP now terminates again (log files are controlled by syslog) o Call CloseModem() when changing devices o Fix parsing of third arg of "delete" I think this fixes the "magic is same" problems that some people have been experiencing. The man page is being rewritten. It'll follow soon.
OpenPOWER on IntegriCloud