summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-01-20 22:47:48 +0000
committerbrian <brian@FreeBSD.org>1998-01-20 22:47:48 +0000
commit74431679837aec6ed3ce13103d276d7b8afd25d8 (patch)
tree288a9a13f0a93d1645e9d0b6dbff2b1e5e1c6242 /usr.sbin/ppp/main.c
parente5842c1bb3cac612cd53a80a3f2b9d17e9cae765 (diff)
downloadFreeBSD-src-74431679837aec6ed3ce13103d276d7b8afd25d8.zip
FreeBSD-src-74431679837aec6ed3ce13103d276d7b8afd25d8.tar.gz
Allow an optional delay when specifying "set openmode active".
The delay defaults to 1 sec (as it always has) unless we've done a ~p in interactive mode or we've actually detected a HDLC frame. This is now cleanly implemented (via async timers) so that it is possible for LCP to come up despite the delay if an LCP REQ is received. This will hopefully solve situations with slow servers or slirp scenarios (where ECHO is left on the port for a second or so before the peer enters packet mode). Also, ~p in interactive mode no longer changes the value of the default openmode delay and -dedicated mode enters packet mode in the right state according to the value of openmode.
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r--usr.sbin/ppp/main.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index c1df109..b526658 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.116 1998/01/08 23:47:52 brian Exp $
+ * $Id: main.c,v 1.117 1998/01/11 17:53:21 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -573,7 +573,7 @@ main(int argc, char **argv)
* Turn into packet mode, where we speak PPP.
*/
void
-PacketMode()
+PacketMode(int delay)
{
if (RawModem() < 0) {
LogPrintf(LogWARN, "PacketMode: Not connected.\n");
@@ -586,7 +586,7 @@ PacketMode()
CcpInit();
LcpUp();
- LcpOpen(VarOpenMode);
+ LcpOpen(delay);
if (mode & MODE_INTER)
TtyCommandMode(1);
if (VarTerm) {
@@ -660,10 +660,8 @@ ReadTty(void)
/*
* XXX: Should check carrier.
*/
- if (LcpFsm.state <= ST_CLOSED) {
- VarOpenMode = OPEN_ACTIVE;
- PacketMode();
- }
+ if (LcpFsm.state <= ST_CLOSED)
+ PacketMode(0);
break;
case '.':
TermMode = 1;
@@ -779,7 +777,7 @@ DoLoop(void)
if (OpenModem() < 0)
return;
LogPrintf(LogPHASE, "Packet mode enabled\n");
- PacketMode();
+ PacketMode(VarOpenMode);
} else if (mode & MODE_DEDICATED) {
if (modem < 0)
while (OpenModem() < 0)
@@ -829,8 +827,7 @@ DoLoop(void)
}
reconnectState = RECON_ENVOKED;
} else if (mode & MODE_DEDICATED)
- if (VarOpenMode == OPEN_ACTIVE)
- PacketMode();
+ PacketMode(VarOpenMode);
}
/*
@@ -864,9 +861,8 @@ DoLoop(void)
LogPrintf(LogCHAT, "Dial attempt %u\n", tries);
if ((res = DialModem()) == EX_DONE) {
- nointr_sleep(1); /* little pause to allow peer starts */
ModemTimeout(NULL);
- PacketMode();
+ PacketMode(VarOpenMode);
dial_up = 0;
reconnectState = RECON_UNKNOWN;
tries = 0;
@@ -1047,7 +1043,7 @@ DoLoop(void)
write(modem, rbuff, cp - rbuff);
write(modem, "\r\n", 2);
}
- PacketMode();
+ PacketMode(0);
} else
write(fileno(VarTerm), rbuff, n);
}
OpenPOWER on IntegriCloud