summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/timer.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a race that can stall the timer when we remove a timer that has anotherbrian2009-05-261-14/+23
| | | | | | | | | | | timer with a <0.05 second delta next to it. This is done by avoiding the possibility of updating the first residual time delta in the timer list to zero. PR: 102747 Submitted by: Sergey Zaharchenko - doublef-ctm at yandex dot ru MFC after: 3 weeks
* Include the correct file (stdarg.h) and use va_list rather than _BSD_VA_LIST_brian2002-08-271-0/+1
| | | | Suggested by: mike
* Remove whitespace at the end of lines.brian2002-06-151-4/+4
|
* Add some missing #includes that weren't required due to namespace polutionbrian2002-05-221-2/+0
| | | | | | in our headers. Submitted by: bde
* Fix an include for NetBSDbrian2002-05-141-0/+3
|
* 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>
* sigpause() -> sigsuspend()brian2001-09-131-7/+11
| | | | sigblock() -> sigprocmask()
* Convert IIJ copyrights to BSD copyrights.brian2001-06-131-18/+24
| | | | Approved by: Toshiharu OHNO <tohno@sirius.ocn.ne.jp>
* When adjusting timer::rest, round to the closest TICKUNIT usecsbrian2000-03-141-6/+8
| | | | | | | | | | | value. This has minimal impact here, but if ppp ever needs to frequently remove timers before they've timed out, it can badly skew the next item in the timer list without this change. The correct fix would be to store usecs in `rest' rather than TICKUNITs, but the math is easier if we just round...
* When we stop a timer that's the first in the timer list, ensurebrian2000-03-141-4/+14
| | | | | | | that we adjust that timers `rest' value (with the current getitimer() values) before using that to adjust the next items `rest' value. After adjusting that value, restart the timer service so that we've now got the correct setitimer() values.
* Add a bunch of `const's and fix a typo.brian1999-12-271-1/+1
| | | | Submitted by: Rich Neswold <rneswold@MCS.Net>
* Update the time delta of the first item in TimerList beforebrian1999-11-191-1/+8
| | | | | | | | | inserting a new item. Without this, it's possible to mis-insert quite badly... but only by as much as the load of the first item, which is almost always 1 second. Initialise the timerservice with `restart' set if we're inserting at the start of the list.
* When more than one timer is expired at once, allow for the possibilitybrian1999-10-151-10/+22
| | | | | | | | | | | | that the first timer ends up doing a timer_Stop() on the second. When this happens, remove the timer from the pending list so that we still call any subsequent timers. This bug has been here for several years, but has only been tickled recently with my device layering changes. With enormous thanks for the perseverance of: Ruslan Ermilov <ru@ucb.crimea.ua>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Adjust our first timer delta according to the returnbrian1999-05-121-5/+12
| | | | | from getitimer() so that times are correct for ``show timer''.
* Deal with the fact that as we now mbuf_Read the fsmbrian1999-05-091-4/+4
| | | | | | | | | header in fsm_Input() we often end up with a NULL mbuf. Deal with a possible NULL mbuf being passed into mbuf_Prepend(). Adjust some spacing to make things more consistent.
* Rather than interrupting 10 times per second then checkingbrian1998-12-141-45/+42
| | | | | | | | | | | to see if there's anything to do, schedule the next alarm based on the next required timeout. This decreases the load when there are lots of relatively idle ppp processes. While I'm in there, handle the possibility that a timeout makes the timer element go out of scope by grabbing the enext pointer before executing the timer function.
* Remove redundant includesbrian1998-06-271-3/+1
|
* Re-initialise our timer service after fork()ingbrian1998-06-201-5/+4
| | | | | | to lose our terminal session. Is this a bug in setitimer() ? - it must be called again in the child !
* o De-staticise things that don't need to be static.brian1998-06-151-3/+3
| | | | | | | | | | 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.
* MFMP: Make ppp multilink capable.brian1998-05-211-109/+70
| | | | See the file README.changes, and re-read the man page.
* Remove unused #includes.brian1998-01-211-5/+3
| | | | | | Make various bits static. Remove unused variables. Submitted by: eivind
* Don't complain that someone's changed the clock unless the timebrian1997-12-291-4/+5
| | | | | | after a select() interrupt is more than 1 second past what should have been the end time. We may just be running on an over-burdened machine.
* Don't expect select() to adjust the passed time when it'sbrian1997-12-281-44/+38
| | | | | | | | | | | interrupted with a SIGALRM. In fact, select() sets the passed time to zero, making the previous implementation terminate always after 1/10th of a second ! Also, deal with someone changing the clock while we're sleeping (and restart the whole sleep). Dangers pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
* Fix prototypes.brian1997-11-221-1/+2
| | | | | | | | | | | | | | 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).
* Introduce ID0 logging.brian1997-11-091-1/+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.
* Cosmetic (no functional changes):brian1997-10-261-8/+16
| | | | | | | | | | | | | | | 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
* Restore back non-interruptable sleep/usleep just redefine them to notache1997-10-231-1/+63
| | | | mix with standard library functions
* Remove private sleep/usleep hacksache1997-10-231-63/+1
|
* Make the code format more in line with style(9).brian1997-08-251-73/+79
| | | | | Update loadalias to use the new libalias api. Update to version 1.1.
* Overhaul ppp:brian1997-06-091-35/+23
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Tidy up the code - bounds checking, returnbrian1997-05-101-3/+7
| | | | | | value checking etc. Submitted by: eivind
* Set setitimer() arg correctly.brian1997-05-091-1/+2
|
* Reviewed by: ache@freebsd.orgbrian1997-03-131-8/+5
| | | | | | | | 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.
* cdefs cleanupache1997-03-091-2/+1
|
* I remove pending signals completely, they are not useless, they areache1997-03-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Don't pend SIGALRM (Timer Service) due toache1997-03-081-3/+3
| | | | | | | | | 1) When carrier dropped, old variant often forget to detect it cause unkillable loop forever (because SIGTERM pended too, but it will be separate commit) 2) Time intervals accuracy reasons Should go into 2.2
* osreldate.h stuff suggested by: Eivind Eklundbrian1997-02-251-1/+2
| | | | | | | | 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-26/+3
| | | | | | | | | | | | | | | | | | 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.
* Move the call to TimerService() into main.c - just after the select()brian1997-01-291-1/+25
| | | | | 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.
* A random bunch of cleanup changes.phk1996-01-101-3/+6
|
* Remove trailing whitespace.rgrimes1995-05-301-8/+8
|
* 1.Reducing cpu usage at off connection.amurai1995-03-111-9/+33
| | | | | | | | | 2.Implment Redail function as working correctly. 3.Clean up a code as I notice. 4.Now, RTT getting close to 50ms with ISDN/TA 38400bps !! Reviewed by: amurai@spec.co.jp Submitted by: amurai@spec.co.jp
* New user Process PPP based on iij-ppp0.94beta2.amurai1995-02-261-14/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Supporting SYNC SIO device (But need a device driver) - add "set speed sync" o Fixing bug for Predictor-1 function. o Add new parameter that re-sent interval for set timeout commands. o Improving RTT (Round Trip Time) and reducing processor time. - Previous Timer service was using polling, and now using SIGALRM ;-) - A 0.94beta2 will not work correctly.... -- Follows are additinal feature not including 0.94beta2 o Support Proxy ARP - add "enable/disable proxy" commands o Marging common routine in CHAP/PAP. o Enhancing LCP/IPCP log information. o Support local Authfication connection on port 300x and tty. - You can set up pair of your "hostname -s" and password in ppp.secret. if either ppp.secret file nor your hostname line don't exist, It will notify a message and working as same as previous version.(Backword compatibility) - If you did set up them, It's allow connection but nothing to do except help and passwd command. - add "passwd yourpasswd" commands o Support afilter - keep Alive filter that a packet can send/receiving according to ifilter/ofilter but doesn't count it as preventing idle timer expires. - Same syntax of other filters. o Fixing bugs reported by current user for previous one. Thanks !! Reviewed by: Atsushi Murai (amurai@spec.co.jp)
* (no commit message)amurai1995-01-311-0/+151
OpenPOWER on IntegriCloud