diff options
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/command.c | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.c | 17 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.h | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.c | 5 | ||||
-rw-r--r-- | usr.sbin/ppp/vars.h | 7 |
5 files changed, 31 insertions, 13 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 51ee9716418..64eca882eb5 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.15 1997/12/27 13:45:18 brian Exp $ + * $Id: command.c,v 1.16 1997/12/29 22:23:04 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 b2403fab5ed..fc0dcfcc48c 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.3 1997/12/28 02:46:57 brian Exp $ + * $Id: ip.c,v 1.4 1997/12/29 22:23:06 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 cf8d012dd5f..04d92663136 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.1 1997/11/23 20:27:34 brian Exp $ + * $Id: ip.h,v 1.2 1997/12/29 22:23:08 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 8abd309a6c7..ad3ddb5bf65 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.3 1997/12/21 03:15:56 brian Exp $ + * $Id: vars.c,v 1.4 1997/12/29 22:23:08 brian Exp $ * */ #include <sys/param.h> @@ -39,13 +39,12 @@ #include "auth.h" char VarVersion[] = "PPP Version 1.5"; -char VarLocalVersion[] = "$Date: 1997/12/21 03:15:56 $"; +char VarLocalVersion[] = "$Date: 1997/12/29 22:23:08 $"; 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 d59ecea4c2f..03bdd167925 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.3 1997/12/21 03:15:58 brian Exp $ + * $Id: vars.h,v 1.4 1997/12/29 22:23:09 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; \ } \ |