summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove initial startup printf's in -direct mode.brian1997-06-011-5/+8
| | | | Make "same magic" error send a NAK (as per rfc).
* Correct the return of DialModem()brian1997-05-291-2/+2
| | | | Suggested by: kfurge <kfurge@worldnet.att.net>
* De-couple ppp from libalias. If libalias isn't there, thebrian1997-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
* Fix the reconnect option, and add an explanation to vars.hbrian1997-05-241-5/+8
|
* Add SO_REUSEADDR socket opt in case the last telnetbrian1997-05-231-1/+2
| | | | | | connection is in a time_wait. Submitted by: Brian Campbell <brianc@pobox.com>
* Use the latest alias engine - now in libalias.brian1997-05-231-5/+5
| | | | Submitted by: Charles Mott <cmott@srv.net>
* Output exit status description of child in background mode.brian1997-05-191-3/+4
|
* Mega update to sort out bad implementationsbrian1997-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().
* Make openmode active by default (for both client/server).brian1997-05-171-5/+2
| | | | Requested by: The masses.
* Build pid_filename without a double slash.brian1997-05-141-5/+9
| | | | | | | Make ``Dial attempt'' diagnostics consistent. Reset lostCarrier when it has reached max. Suggested by: Kevin Street <street@iName.com>
* Create ttyXX.if and tunX.pid irrespective ofbrian1997-05-111-23/+24
| | | | | | whether we're -dedicated. Required by: David Nugent <davidn@labs.usn.blaze.net.au>
* Add a ttyXX.if file in /var/run that points tobrian1997-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>
* Tidy up the code - bounds checking, returnbrian1997-05-101-26/+23
| | | | | | value checking etc. Submitted by: eivind
* Log each ppp line to separate /var/log/ppp.tunX.log instead mixing ofache1997-05-041-6/+2
| | | | all lines into single /var/log/ppp.log
* Add a reconnect capability directing ppp to re-establishbrian1997-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)
* Make the next number redial ability configurable. Thebrian1997-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
* Make -background option attempt each phone number at mostbrian1997-04-131-3/+8
| | | | | once. Make -background ignore redial. Output exit value to syslog with "PPP Terminated" message.
* Only wait for the redial timeout when the last phone number in thebrian1997-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.
* Ignore SIGPIPE or any user can quit ppp just telnetting to itache1997-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
* Closes pr 2711brian1997-03-131-10/+25
| | | | | | Fix -background option. Parent returns after the line is established (or not established). Definitely a candidate for 2.2
* Requested by: Harlan Stenn <Harlan.Stenn@pfcs.com>brian1997-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).
* Reviewed by: ache@freebsd.orgbrian1997-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.
* Don't waste time scanning tun_in+10 descriptors, scan exactly whatache1997-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
* I remove pending signals completely, they are not useless, they areache1997-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.
* Unpend fault signals like SIGSEGV, etcache1997-03-081-4/+4
| | | | | | It is too dangerous to continue with them in any case Should go into 2.2
* Unpend all killing signals to shut down this thing immediately,ache1997-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
* osreldate.h stuff suggested by: Eivind Eklundbrian1997-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 ?
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Tidy up signal handling.brian1997-02-191-40/+18
| | | | | | | | | | | | | | | | | | All signal() calls have been changed to pending_signal() calls. pending_signal() is defined in the new sig.c file. It remembers the handler and traps the signal with a function that will remember the signal. main.c now calls handle_signals() to actually call the required handlers (if the above handler was called). If this doesn't close PR2662 (was PR2347), I'll cry. Joerg, I think this should go into 2.2, but I havn't done anything about it because I'm bound to botch it with the new sig.[ch] files. I've just "cvs add"'d sig.[ch] so far.... can you update to 2.2 and tell me what you did ? Thanks.
* Check the timer request flag irrespective of wheter select() came back withbrian1997-01-301-10/+26
| | | | EINTR - it's possible that it happened at some other point in the loop.
* Move the call to TimerService() into main.c - just after the select()brian1997-01-291-0/+10
| | | | | call. The SIGALRM just sets a flag now, preventing the possibility of any nasty recursivness in the handler itself.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Fix many buffer overruns in the code. Specifically, disallow ExpandStringimp1997-01-101-2/+2
| | | | | | | | | | | | | to be used to expand things beyond the size of the buffer passed in. Also do a general cleanup of sprintf -> snprintf as well as strcpy and strncat safety. Also expand some buffers to allow for the largest possible data that might be used. This is a 2.2 candidate. However, it needs to be vetted on -current since little testing has been done on this due to my lack of PPP on this machine. Reviewed by: Jordan Hubbard, Peter Wemm, Guido van Rooij
* For /usr/sbin/ppp, you must choose between running ppp in the background orjkh1996-12-221-32/+80
| | | | | | | | | | | | | | | | | | | | | | connecting to a host immediately in the foreground. I would like to be able to run ppp from a script so that my script can be sure that it is connected to the 'net before it continues running: # Dial up the internet. ppp -background myprovider || exit 1 do-some-net-command # Hang up the modem. kill -HUP `cat /var/run/ppp.tun0.pid` Another problem is that the current ppp calls its process id file `/var/run/PPP.server', which may conflict if you have more than one IP tunnel interface available. Closes PR#1469 Submitted by: Gord Matzigkeit <gord@enci.ucalgary.ca>
* Fixed prototypes of PacketAliasIn/Out. (cosmetic)nate1996-12-191-5/+5
| | | | Submitted by: Brian Somers <brian@awfulhak.demon.co.uk>
* The infamous IP aliasing code for ppp, modified to work as a runtime optionjkh1996-12-121-4/+21
| | | | | | | (otherwise ppp's behavior remains unchanged) and documented by myself, Steve Sims, Nate Williams, Martin Renters and god-only-knows who else. :-) Submitted by: nate Obtained from: Charles Mott <cmott@srv.net>
* Added my 'ddial' patches to user-PPP. The new mode tries it's darndestnate1996-12-031-6/+17
| | | | | | | to keep the link up, so it re-dials whenever it detects the link go down. This is useful for 'dedicated' links who use PPP. It's been used for over a year w/out problems at different sites.
* 1. Room to calculate MD5 for CHAP negotiation is shorter thanjkh1996-10-121-1/+5
| | | | | | | | | | | | | | | | required. a core is not dumped at first connecting time and dumped at second or third time. (patch I) 2. A routine for "show route" refers out of allocated space. Values pointed by "lp" should be read as CHAR, I think. there is also no free() for disallocation. (patch II) Here is also a patch for an improvement: In current imprementation, even if PPP connection is disconnected by time out, prompt of interactive mode does not change from "PPP>" to "ppp>" to indicate the disconnection on a terminal. So I modified the code to do that. (patch III) Submitted-By: NAKAMURA Motonori <motonori@econ.kyoto-u.ac.jp>
* Properly include prototypes.jkh1996-10-071-1/+2
| | | | Submitted-by: "Daniel O'Callaghan" <danny@panda.hilink.com.au>
* Dump core on SIGSEGV instead of silent exiting. I saw SIGSEGV few times,ache1996-07-091-1/+6
| | | | | but they are VERY rare to tracking down this bug. I hope core helps to track it down.
* Here is a diff of /usr/src/usr.sbin/ppp against current. The diffsphk1996-05-111-10/+10
| | | | | | | | | | | | | | | | | | | add some logging functionality which I find very useful. 'set debug link' will record just link up/down and address assignments. 'set debug connect' will record the entire chat dialog 'set debug carrier' will record just chat lines including 'CARRIER' (so that I can be sure I'm getting a 28.8 line). There was a global change required to permit LogPrintf to take a bit mask instead of a bit position value (to permit logging some events on either of two flags, so that no change in 'set debug lcp' would result from the code supporting 'link'. Thus the diffs are rather long for such a small change. The man page is also touched. Oh, and there was a slight syntax problem in route.c Reviewed by: phk Submitted by: Tony Kimball <alk@Think.COM>
* Fixed a couple of format strings to match the change of pid_t from longbde1996-04-131-2/+2
| | | | | | to int32_t. I only fixed the ones that I noticed the warnings for. Perhaps most of the format strings are correct now because they were wrong before. Except of course if int32_t isn't compatible with `int'.
* Put signal number into logfileache1996-03-301-5/+7
|
* 1) Open /dev/null for std* after setsid() to be shure that modem isache1996-03-091-1/+10
| | | | | | | | | *not* our controlling terminal (SIGHUP can coming in other case) 2) Add HUPCL for non-dedicated lines to be shure that modem properly resetted. 3) Correct usage string.
* 1) Add multi-phone dialing/redialing, several phones separated by ':'ache1996-03-081-2/+5
| | | | | | | | | | 2) Improve on-line help subsystem 3) Make 'term' mode works even carrier dropped (old code close line forever here) 4) Make 'term' mode 8bit clean. 5) Improve manual page 6) #ifdef DEBUG diagnostic about missing optional files. 7) Don't put interactive dialing info to logfile
* Some patches to ppp which improve stability. I have been running adfr1996-01-301-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ppp based on these patches for about 3 weeks with no downtime. The original submitters comments: Two features iijppp has over kernel ppp that I like are predictor1 compression and demand dialing. Here are a few bug fixes. I expanded the priority queueing scheme and discovered it was broken due to the assignment at ip.c line 300. All packets were being queued at the same priority. Fixing priority queueing broke predictor1 compression. Packets were compressed before being queued and predictor1 worked as long as the packets were popped off the queue in the same order they were pushed onto the queue. There were a few byte order problems in IP header tests also. There is a recursion problem in SendLqrReport(). LcpClose() is called when "Too many echo packets are lost" which winds up in SendLqrReport() again. I believe the original intention was to just stop the LQR timer with the call to StopLqr() but the side effects hurt. Submitted by: John Capo <jc@irbs.com>
* Final cleanup for now. -Wall is now silent. A couple of bogons found.phk1996-01-111-3/+7
|
* A random bunch of cleanup changes.phk1996-01-101-4/+2
|
* 1. Add a settable redial timer and logging of the process id in a file.amurai1995-10-081-29/+64
| | | | | | | | | | | | | | | A settable redial timer helps to avoid the problem where both ends of a link want to dial at the same time and the line winds up busy for both ends. The process id is logged in /var/run/PPP.system where system is the name of the called system. When both ends of a link are running in demand dial mode, you need an easy way to get the pid of the ppp on the called end so it can be killed and re-started with -direct or pppd started to handle the incoming ppp session. 2. Add secret description for "set timeout" to man. Reviewed by: Atsushi Murai <amurai@spec.co.jp> Submitted by: John Capo <jc@irbs.com>
* Fix a comment that became wrong when it was moved in rev. 1.7. Fix nearbybde1995-09-181-8/+6
| | | | indentation. Cosmetic.
OpenPOWER on IntegriCloud