summaryrefslogtreecommitdiffstats
path: root/usr.sbin
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
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')
-rw-r--r--usr.sbin/ppp/command.c10
-rw-r--r--usr.sbin/ppp/ip.c17
-rw-r--r--usr.sbin/ppp/ip.h5
-rw-r--r--usr.sbin/ppp/vars.c5
-rw-r--r--usr.sbin/ppp/vars.h7
5 files changed, 31 insertions, 13 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index dc4f9cf..8d159cf 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.119 1997/12/27 07:22:12 brian Exp $
+ * $Id: command.c,v 1.120 1997/12/27 13:45:45 brian Exp $
*
*/
#include <sys/param.h>
@@ -444,10 +444,16 @@ ShowEscape(struct cmdargs const *arg)
static int
ShowTimeout(struct cmdargs const *arg)
{
- if (VarTerm)
+ if (VarTerm) {
+ int remaining;
+
fprintf(VarTerm, " Idle Timer: %d secs LQR Timer: %d secs"
" Retry Timer: %d secs\n", VarIdleTimeout, VarLqrTimeout,
VarRetryTimeout);
+ remaining = RemainingIdleTime();
+ if (remaining != -1)
+ fprintf(VarTerm, " %d secs remaining\n", remaining);
+ }
return 0;
}
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;
}
}
diff --git a/usr.sbin/ppp/ip.h b/usr.sbin/ppp/ip.h
index 056d655..2f3d992 100644
--- a/usr.sbin/ppp/ip.h
+++ b/usr.sbin/ppp/ip.h
@@ -17,14 +17,15 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ip.h,v 1.6 1997/10/26 01:02:53 brian Exp $
+ * $Id: ip.h,v 1.7 1997/10/26 12:42:11 brian Exp $
*
*/
extern void IpStartOutput(void);
-extern int PacketCheck(char *, int, int);
+extern int PacketCheck(char *, int, int);
extern void IpEnqueue(int, char *, int);
extern void IpInput(struct mbuf *);
extern void StartIdleTimer(void);
extern void StopIdleTimer(void);
extern void UpdateIdleTimer(void);
+extern int RemainingIdleTime(void);
diff --git a/usr.sbin/ppp/vars.c b/usr.sbin/ppp/vars.c
index 015e7bb..494244e 100644
--- a/usr.sbin/ppp/vars.c
+++ b/usr.sbin/ppp/vars.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vars.c,v 1.40 1997/12/13 02:37:33 brian Exp $
+ * $Id: vars.c,v 1.41 1997/12/21 03:16:17 brian Exp $
*
*/
#include <sys/param.h>
@@ -39,13 +39,12 @@
#include "auth.h"
char VarVersion[] = "PPP Version 1.6";
-char VarLocalVersion[] = "$Date: 1997/12/13 02:37:33 $";
+char VarLocalVersion[] = "$Date: 1997/12/21 03:16:17 $";
int Utmp = 0;
int ipInOctets = 0;
int ipOutOctets = 0;
int ipKeepAlive = 0;
int ipConnectSecs = 0;
-int ipIdleSecs = 0;
int reconnectState = RECON_UNKNOWN;
int reconnectCount = 0;
diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h
index b9db977..2ffa131 100644
--- a/usr.sbin/ppp/vars.h
+++ b/usr.sbin/ppp/vars.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vars.h,v 1.37 1997/12/03 23:28:02 brian Exp $
+ * $Id: vars.h,v 1.38 1997/12/21 03:16:19 brian Exp $
*
* TODO:
*/
@@ -160,7 +160,6 @@ extern int ipInOctets;
extern int ipOutOctets;
extern int ipKeepAlive;
extern int ipConnectSecs;
-extern int ipIdleSecs;
extern int reconnectState;
extern int reconnectCount;
@@ -170,8 +169,8 @@ extern int reconnectCount;
#define RECON_ENVOKED (4)
#define reconnect(x) \
do \
- if (reconnectState == RECON_UNKNOWN) { \
- reconnectState = x; \
+ if (reconnectState == RECON_UNKNOWN) { \
+ reconnectState = x; \
if (x == RECON_FALSE) \
reconnectCount = 0; \
} \
OpenPOWER on IntegriCloud