Untangle some cunfusion between the CLOSE_STAYDOWN, CLOSE_LCP and

CLOSE_NORMAL meanings.  CLOSE_NORMAL doesn't change the currently
required state, the others do.  This should stop ppp from entering
DATALINK_READY when LCP shutdown doesn't end up happening cleanly.

Bump our version number to reflect this change.
This commit is contained in:
Brian Somers 2001-02-04 01:08:22 +00:00
parent a567cf6dd6
commit 2fc2f70582
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71970
3 changed files with 21 additions and 18 deletions

View File

@ -376,7 +376,7 @@ bundle_Close(struct bundle *bundle, const char *name, int how)
switch (how) {
case CLOSE_LCP:
datalink_DontHangup(dl);
/* fall through */
break;
case CLOSE_STAYDOWN:
datalink_StayDown(dl);
break;

View File

@ -151,7 +151,7 @@
#define NEG_MPPE 54
#define NEG_CHAP81 55
const char Version[] = "2.3";
const char Version[] = "2.3.1";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);

View File

@ -510,15 +510,17 @@ datalink_Write(struct fdescriptor *d, struct bundle *bundle,
static void
datalink_ComeDown(struct datalink *dl, int how)
{
if (how != CLOSE_NORMAL) {
dl->dial.tries = -1;
dl->reconnect_tries = 0;
if (dl->state >= DATALINK_READY && how == CLOSE_LCP)
dl->stayonline = 1;
}
int stayonline;
if (dl->state >= DATALINK_READY && dl->stayonline) {
dl->stayonline = 0;
if (how == CLOSE_LCP)
datalink_DontHangup(dl);
else if (how == CLOSE_STAYDOWN)
datalink_StayDown(dl);
stayonline = dl->stayonline;
dl->stayonline = 0;
if (dl->state >= DATALINK_READY && stayonline) {
physical_StopDeviceTimer(dl->physical);
datalink_NewState(dl, DATALINK_READY);
} else if (dl->state != DATALINK_CLOSED && dl->state != DATALINK_HANGUP) {
@ -993,13 +995,11 @@ datalink_Close(struct datalink *dl, int how)
case DATALINK_AUTH:
case DATALINK_LCP:
datalink_AuthReInit(dl);
if (how == CLOSE_LCP)
datalink_DontHangup(dl);
else if (how == CLOSE_STAYDOWN)
datalink_StayDown(dl);
fsm_Close(&dl->physical->link.lcp.fsm);
if (how != CLOSE_NORMAL) {
dl->dial.tries = -1;
dl->reconnect_tries = 0;
if (how == CLOSE_LCP)
dl->stayonline = 1;
}
break;
default:
@ -1033,14 +1033,17 @@ datalink_Down(struct datalink *dl, int how)
void
datalink_StayDown(struct datalink *dl)
{
dl->dial.tries = -1;
dl->reconnect_tries = 0;
dl->stayonline = 0;
}
void
datalink_DontHangup(struct datalink *dl)
{
if (dl->state >= DATALINK_LCP)
dl->stayonline = 1;
dl->dial.tries = -1;
dl->reconnect_tries = 0;
dl->stayonline = dl->state >= DATALINK_LCP ? 1 : 0;
}
int