summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ip.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-12-29 22:23:13 +0000
committerbrian <brian@FreeBSD.org>1997-12-29 22:23:13 +0000
commitbb76302c2dd51eabb0ac42e6cae5a4399d1f92ff (patch)
treee044b1a166f0cc2bf3d74ab320c3d46905af0886 /usr.sbin/ppp/ip.c
parentc38e16bb3b5d09bb3a3717545baa500e4b506d09 (diff)
downloadFreeBSD-src-bb76302c2dd51eabb0ac42e6cae5a4399d1f92ff.zip
FreeBSD-src-bb76302c2dd51eabb0ac42e6cae5a4399d1f92ff.tar.gz
Show how much time is left before timing out in the
`show timeout' output. Remove ipIdleSecs variable - it's not used.
Diffstat (limited to 'usr.sbin/ppp/ip.c')
-rw-r--r--usr.sbin/ppp/ip.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index 0c9df16..6f9a30e 100644
--- a/usr.sbin/ppp/ip.c
+++ b/usr.sbin/ppp/ip.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ip.c,v 1.33 1997/12/24 09:29:01 brian Exp $
+ * $Id: ip.c,v 1.34 1997/12/28 02:46:22 brian Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@@ -86,11 +86,15 @@ IdleTimeout(void *v)
void
StartIdleTimer()
{
+ static time_t IdleStarted;
+
if (!(mode & (MODE_DEDICATED | MODE_DDIAL))) {
StopTimer(&IdleTimer);
IdleTimer.func = IdleTimeout;
IdleTimer.load = VarIdleTimeout * SECTICKS;
IdleTimer.state = TIMER_STOPPED;
+ time(&IdleStarted);
+ IdleTimer.arg = (void *)&IdleStarted;
StartTimer(&IdleTimer);
}
}
@@ -108,6 +112,15 @@ StopIdleTimer()
StopTimer(&IdleTimer);
}
+int
+RemainingIdleTime()
+{
+ if (VarIdleTimeout == 0 || IdleTimer.state != TIMER_RUNNING ||
+ IdleTimer.arg == NULL)
+ return -1;
+ return VarIdleTimeout - (time(NULL) - *(time_t *)IdleTimer.arg);
+}
+
/*
* If any IP layer traffic is detected, refresh IdleTimer.
*/
@@ -115,8 +128,8 @@ static void
RestartIdleTimer(void)
{
if (!(mode & (MODE_DEDICATED | MODE_DDIAL)) && ipKeepAlive) {
+ time((time_t *)IdleTimer.arg);
StartTimer(&IdleTimer);
- ipIdleSecs = 0;
}
}
OpenPOWER on IntegriCloud