diff options
author | brian <brian@FreeBSD.org> | 1997-04-21 01:02:02 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-04-21 01:02:02 +0000 |
commit | ad4ab187936a54f3a8329d804592f12284e6c176 (patch) | |
tree | 7b87206f10e0b3c6831b1d1b453f11c55a48e172 /usr.sbin/ppp/main.c | |
parent | ca8a9db2701fdcbcc35546f2de8867e0b669e7bc (diff) | |
download | FreeBSD-src-ad4ab187936a54f3a8329d804592f12284e6c176.zip FreeBSD-src-ad4ab187936a54f3a8329d804592f12284e6c176.tar.gz |
Add a reconnect capability directing ppp to re-establish
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)
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r-- | usr.sbin/ppp/main.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index bb876af..f1e1d00 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.43 1997/04/13 00:54:43 brian Exp $ + * $Id: main.c,v 1.44 1997/04/14 23:48:15 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -735,6 +735,7 @@ DoLoop() timeout.tv_sec = 0; timeout.tv_usec = 0; + lostCarrier = 0; if (mode & MODE_BACKGROUND) dial_up = TRUE; /* Bring the line up */ @@ -752,11 +753,24 @@ DoLoop() if (mode & MODE_DDIAL && LcpFsm.state <= ST_CLOSED) dial_up = TRUE; + /* + * If we lost carrier and want to re-establish the connection + * due to the "set reconnect" value, we'd better bring the line + * back up now. + */ + if (LcpFsm.state <= ST_CLOSED && dial_up != TRUE + && lostCarrier && lostCarrier <= VarReconnectTries) { + LogPrintf(LOG_PHASE_BIT, "Connection lost, re-establish (%d/%d)\n", + lostCarrier, VarReconnectTries); + StartRedialTimer(VarReconnectTimer); + dial_up = TRUE; + } + /* - * If Ip packet for output is enqueued and require dial up, + * If Ip packet for output is enqueued and require dial up, * Just do it! */ - if ( dial_up && RedialTimer.state != TIMER_RUNNING ) { /* XXX */ + if ( dial_up && RedialTimer.state != TIMER_RUNNING ) { #ifdef DEBUG logprintf("going to dial: modem = %d\n", modem); #endif |