aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Correct the way the uucp lock file and the ttyXX.if lockBrian Somers1997-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). Notes: svn path=/head/; revision=29696
* It turns out that the following:Brian Somers1997-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> Notes: svn path=/head/; revision=29668
* Don't close(1) in direct mode and then proceed toBrian Somers1997-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> Notes: svn path=/head/; revision=29551
* o Fix two unlikely descriptor leaks.Brian Somers1997-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(). Notes: svn path=/head/; revision=29521
* Install as group ``network''Brian Somers1997-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" Notes: svn path=/head/; revision=29083
* Cosmetic: Make LogPrintf() calls consistent.Brian Somers1997-08-311-7/+7
| | | | Notes: svn path=/head/; revision=28974
* Remove use of login_progok()Brian Somers1997-08-311-9/+1
| | | | | | | Suggested by: guido Notes: svn path=/head/; revision=28961
* Use login_progok().Brian Somers1997-08-271-38/+3
| | | | Notes: svn path=/head/; revision=28842
* Check the "prog.deny" login.conf capability andBrian Somers1997-08-261-1/+44
| | | | | | | | refuse to run if "ppp" is in the list. Suggested by: "Daniel O'Callaghan" <danny@panda.hilink.com.au> Notes: svn path=/head/; revision=28815
* Lose a couple of extraneous backslashes.Brian Somers1997-08-251-5/+3
| | | | Notes: svn path=/head/; revision=28684
* Make the code format more in line with style(9).Brian Somers1997-08-251-244/+233
| | | | | | | | Update loadalias to use the new libalias api. Update to version 1.1. Notes: svn path=/head/; revision=28679
* Add "set loopback on|off", defaulting to "on".Brian Somers1997-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 :-) Notes: svn path=/head/; revision=28536
* Make HUP cause an exit (as it used to), and makeBrian Somers1997-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 Notes: svn path=/head/; revision=27157
* Fix HUP handling while dialing.Brian Somers1997-06-291-3/+6
| | | | | | | Pointed out by: ache Notes: svn path=/head/; revision=27061
* Add "set server" to control the server socket.Brian Somers1997-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 Notes: svn path=/head/; revision=26940
* Fix ~? output in "term" mode.Brian Somers1997-06-241-9/+9
| | | | | | | Spotted by: Harry Starr <starr@gccs.com.au> Notes: svn path=/head/; revision=26901
* o Fix uptime for direct connections.Brian Somers1997-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> Notes: svn path=/head/; revision=26858
* Handle redial tries correctly under -ddialBrian Somers1997-06-171-10/+11
| | | | Notes: svn path=/head/; revision=26696
* Set netfd to STDOUT_FILENO rather than STDIN_FILENO.Brian Somers1997-06-161-2/+2
| | | | Notes: svn path=/head/; revision=26690
* Remove call to daemon(). Just call setsid() and closeBrian Somers1997-06-161-7/+10
| | | | | | | | any relevent descriptors (0,2,[1]). We've already fork()d. PR: 3874 Notes: svn path=/head/; revision=26686
* Sort out ppp over tcp:Brian Somers1997-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. Notes: svn path=/head/; revision=26551
* Overhaul ppp:Brian Somers1997-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. Notes: svn path=/head/; revision=26516
* Remove initial startup printf's in -direct mode.Brian Somers1997-06-011-5/+8
| | | | | | | Make "same magic" error send a NAK (as per rfc). Notes: svn path=/head/; revision=26328
* Correct the return of DialModem()Brian Somers1997-05-291-2/+2
| | | | | | | Suggested by: kfurge <kfurge@worldnet.att.net> Notes: svn path=/head/; revision=26256
* De-couple ppp from libalias. If libalias isn't there, theBrian Somers1997-05-261-6/+8
| | | | | | | | | | | | alias commands simply won't work. Only root may specify the location of the alias lib (otherwise, it's hard-coded). Make logprintf silently fail if LogOpen hasn't been called. Suggested by: eivind Notes: svn path=/head/; revision=26142
* Fix the reconnect option, and add an explanation to vars.hBrian Somers1997-05-241-5/+8
| | | | Notes: svn path=/head/; revision=26098
* Add SO_REUSEADDR socket opt in case the last telnetBrian Somers1997-05-231-1/+2
| | | | | | | | | connection is in a time_wait. Submitted by: Brian Campbell <brianc@pobox.com> Notes: svn path=/head/; revision=26032
* Use the latest alias engine - now in libalias.Brian Somers1997-05-231-5/+5
| | | | | | | Submitted by: Charles Mott <cmott@srv.net> Notes: svn path=/head/; revision=26031
* Output exit status description of child in background mode.Brian Somers1997-05-191-3/+4
| | | | Notes: svn path=/head/; revision=25910
* Mega update to sort out bad implementationsBrian Somers1997-05-191-51/+70
| | | | | | | | | | | | | | | | | | | | | of reconnect & -background. o Fix reconnect anomolies. o Make reconnect apply to failed LQR hangups (& mention in man page). o Make reconnect effective in -background mode. o Listen on socket in -background mode. o Try all phone numbers in -background mode. o Insist on system arg in -background mode. o Make a control-connection close command exit in -background mode. o Output status message to stdout on exit of parent in -background mode. o Don't notify parent of success too soon. o Describe termination EX_* code. o Miscelaneous diagnostic corrections. o Remove redundant connect_time from modem.c. o Don't repeatedly DownConnection(). Notes: svn path=/head/; revision=25908
* Make openmode active by default (for both client/server).Brian Somers1997-05-171-5/+2
| | | | | | | Requested by: The masses. Notes: svn path=/head/; revision=25872
* Build pid_filename without a double slash.Brian Somers1997-05-141-5/+9
| | | | | | | | | | Make ``Dial attempt'' diagnostics consistent. Reset lostCarrier when it has reached max. Suggested by: Kevin Street <street@iName.com> Notes: svn path=/head/; revision=25801
* Create ttyXX.if and tunX.pid irrespective ofBrian Somers1997-05-111-23/+24
| | | | | | | | | whether we're -dedicated. Required by: David Nugent <davidn@labs.usn.blaze.net.au> Notes: svn path=/head/; revision=25707
* Add a ttyXX.if file in /var/run that points toBrian Somers1997-05-101-9/+19
| | | | | | | | | | the tunX.pid file. Change the ppp.tunX.pid name to tunX.pid Requested by: Daniel O Callaghan <danny@panda.hilink.com.au> Notes: svn path=/head/; revision=25634
* Tidy up the code - bounds checking, returnBrian Somers1997-05-101-26/+23
| | | | | | | | | value checking etc. Submitted by: eivind Notes: svn path=/head/; revision=25630
* Log each ppp line to separate /var/log/ppp.tunX.log instead mixing ofAndrey A. Chernov1997-05-041-6/+2
| | | | | | | all lines into single /var/log/ppp.log Notes: svn path=/head/; revision=25445
* Add a reconnect capability directing ppp to re-establishBrian Somers1997-04-211-3/+17
| | | | | | | | | | | | | | the connection after an unexpected loss of carrier: set reconnect timer ntries The man page warns against using this command when your timeout value is slightly more than the other sides :{} Suggested by: burton@bsampley.vip.best.com (Burton Sampley) Notes: svn path=/head/; revision=25067
* Make the next number redial ability configurable. TheBrian Somers1997-04-141-15/+15
| | | | | | | | | | | | "set redial pause [times]" command becomes "set redial end-pause[.next-pause] [times]" and next-pause defaults to 3 seconds. This keeps things backwards compatable. Suggested by: ache Notes: svn path=/head/; revision=24939
* Make -background option attempt each phone number at mostBrian Somers1997-04-131-3/+8
| | | | | | | | once. Make -background ignore redial. Output exit value to syslog with "PPP Terminated" message. Notes: svn path=/head/; revision=24844
* Only wait for the redial timeout when the last phone number in theBrian Somers1997-04-121-9/+20
| | | | | | | | | | | | | | list has been dialed. Alternate number dialing has no "pause". Suggested by: joerg Document this behaviour. Document that the number of dial attempts applies to the number of phone calls rather than the number of times each number is dialed. Add a missing .El. Give a decent description of how to connect to an ISP. Notes: svn path=/head/; revision=24843
* Ignore SIGPIPE or any user can quit ppp just telnetting to itAndrey A. Chernov1997-04-091-9/+16
| | | | | | | | | and quitting telnet immediately (while phone number dialed) Log client connection/disconnection with PHASE_BIT now. Add more error recovery on client disconnection Notes: svn path=/head/; revision=24753
* Closes pr 2711Brian Somers1997-03-131-10/+25
| | | | | | | | | Fix -background option. Parent returns after the line is established (or not established). Definitely a candidate for 2.2 Notes: svn path=/head/; revision=23863
* Requested by: Harlan Stenn <Harlan.Stenn@pfcs.com>Brian Somers1997-03-131-3/+3
| | | | | | | | | | | | | | Accept SIGHUP as a "re-open logfile" signal. As ppp doesn't set it's serial line to it's controlling terminal, we can use HUP :) This is a candidate for 2.2. The log.[ch] changes won't conflict, but the main.c changes will. We just want to change the kill(...,SIGHUP) to a SIGTERM and change the signal(SIGHUP,Hangup) to a pending_signal(SIGHUP,LogReOpen). Notes: svn path=/head/; revision=23842
* Reviewed by: ache@freebsd.orgBrian Somers1997-03-131-13/+17
| | | | | | | | | | | These changes should fix the signal "problems" in ppp. The signal changes should really be put into 2.2 too ! The following patches should do it. There were some other changes made by Andrey recently that havn't been brought into 2.2, it may be worth doing them now. Notes: svn path=/head/; revision=23840
* Don't waste time scanning tun_in+10 descriptors, scan exactly whatAndrey A. Chernov1997-03-101-22/+33
| | | | | | | | | | we need now. Don't assume that file descriptor can't be 0 (many places) Protect FD_* macros from being used with negative descriptors Shorten MS EXT show help to fit 80 cols Notes: svn path=/head/; revision=23598
* I remove pending signals completely, they are not useless, they areAndrey A. Chernov1997-03-091-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dangerous! Signal handlers themself must be fixed to not call malloc, but no pended handlers, it will be correct fix. In finite case each signal handler can set some variable which will be analized later, but calling handler functions manually is too dangerous (f.e. signals not blocked while the handler or handlers switch executed in this case). Of course this code can be fixed instead of removing, but it not worth fixing in any case. Should go into 2.2 In addition sig.c code shows following dangerous fragments (there can be more, but I stop after two): This fragment if (fn == SIG_DFL || fn == SIG_IGN) { handler[sig-1] = (sig_type)0; <------------- here signal(sig,fn); } else { cause NULL pointer reference when signal comes "here", but more worse fragment is below: void handle_signals() { int sig; if (caused) for (sig=0; sig<__MAXSIG; sig++, caused>>=1) if (caused&1) (*handler[sig])(sig+1); } caused is bitmask which set corresponding bit on each signal coming. And now imagine, what happens when some signal comes (bit sets) while loop is executed (see caused>>=1 !!!) In this light carrier drop situation was (as gdb shows) 1. SIGSEGV in handle_signals because some junk called as *handler reference. 2. Since SIGSEGV was pended too (== never happens), it can cause various range of disasters. Notes: svn path=/head/; revision=23584
* Unpend fault signals like SIGSEGV, etcAndrey A. Chernov1997-03-081-4/+4
| | | | | | | | | It is too dangerous to continue with them in any case Should go into 2.2 Notes: svn path=/head/; revision=23513
* Unpend all killing signals to shut down this thing immediately,Andrey A. Chernov1997-03-081-5/+5
| | | | | | | | | | or it is impossible to kill it in some situations. Unpend yet one SIGARLM (see timer.c commit) Should go into 2.2 Notes: svn path=/head/; revision=23505
* osreldate.h stuff suggested by: Eivind EklundBrian Somers1997-02-251-1/+3
| | | | | | | | | | | Remove #include's from sig.h and get dependant modules to include them themselves. Make inclusion of if_var.h depend on __FreeBSD_version so that the -current version of ppp can be used with 2.1.* 2.2 Candidate ? Notes: svn path=/head/; revision=23114
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22997