diff options
author | brian <brian@cvs.openbsd.org> | 1998-01-20 22:46:33 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1998-01-20 22:46:33 +0000 |
commit | 3d2201a7982c109e8fc6c5a6a83083f7c0a26303 (patch) | |
tree | 2d37ccc60ab36afd94ca01e70d677e7fcb350e71 /usr.sbin/ppp/main.c | |
parent | 9c88dd386e8011d11f46ffbeec2a412dc2c9edc5 (diff) |
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.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 1a2a18b0d5c..5e0c7358ae6 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.13 1998/01/11 17:55:19 brian Exp $ + * $Id: main.c,v 1.14 1998/01/20 22:46:27 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); } |