diff options
author | brian <brian@FreeBSD.org> | 1997-09-22 02:51:24 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-09-22 02:51:24 +0000 |
commit | e74401cd50a1d7d9cfd27e727b355b2556108aab (patch) | |
tree | 2f6ab04857ee8a712ae8191598470cb4ddd85737 /usr.sbin | |
parent | ed62efbf2d85f7b67aa74e2a4b5c4379a40f12db (diff) | |
download | FreeBSD-src-e74401cd50a1d7d9cfd27e727b355b2556108aab.zip FreeBSD-src-e74401cd50a1d7d9cfd27e727b355b2556108aab.tar.gz |
Don't pause for one second before starting LCP
negotiation. Instead, incrementally pause after
receiving LCPs with the same magic. We can now
suffer a server that waits more than 1 second before
responding. Pauses greater than a second get
hopelessly confusing as when the server eventually
starts, it sees a flood of Config Requests followed
by config NAKs and changes of magic. This causes the
server to change its magic over and over.....
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/lcp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index c2392d7..1aa31b0 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: lcp.c,v 1.30 1997/09/03 02:08:19 brian Exp $ + * $Id: lcp.c,v 1.31 1997/09/21 23:01:34 brian Exp $ * * TODO: * o Validate magic number received from peer. @@ -26,6 +26,7 @@ #include <sys/time.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <signal.h> #include "fsm.h" #include "lcp.h" #include "ipcp.h" @@ -93,6 +94,7 @@ struct fsm LcpFsm = { }; static struct pppTimer LcpReportTimer; +static int LcpFailedMagic; char *PhaseNames[] = { "Dead", "Establish", "Authenticate", "Network", "Terminate" @@ -376,11 +378,13 @@ void LcpUp() { FsmUp(&LcpFsm); + LcpFailedMagic = 0; } void LcpDown() { /* Sudden death */ + LcpFailedMagic = 0; NewPhase(PHASE_DEAD); StopAllTimers(); FsmDown(&LcpFsm); @@ -390,8 +394,7 @@ void LcpOpen(int mode) { LcpFsm.open_mode = mode; - if (mode == OPEN_ACTIVE) - sleep(1); /* Give the peer time to start up */ + LcpFailedMagic = 0; FsmOpen(&LcpFsm); } @@ -399,6 +402,7 @@ void LcpClose() { FsmClose(&LcpFsm); + LcpFailedMagic = 0; } /* @@ -566,14 +570,18 @@ LcpDecodeConfig(u_char * cp, int plen, int mode) if (LcpInfo.want_magic) { /* Validate magic number */ if (magic == LcpInfo.want_magic) { - LogPrintf(LogLCP, "Magic is same (%08x)\n", magic); + LogPrintf(LogLCP, "Magic is same (%08x) - %d times\n", + magic, ++LcpFailedMagic); LcpInfo.want_magic = GenerateMagic(); bcopy(cp, nakp, 6); nakp += 6; + ualarm(TICKUNIT * (4 + 4 * LcpFailedMagic), 0); + sigpause(0); } else { LcpInfo.his_magic = magic; bcopy(cp, ackp, length); ackp += length; + LcpFailedMagic = 0; } } else { LcpInfo.my_reject |= (1 << type); |