diff options
author | brian <brian@cvs.openbsd.org> | 2001-02-04 01:14:25 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2001-02-04 01:14:25 +0000 |
commit | ee86f0c67f881094ad0ddc1dd0b393be5a18911e (patch) | |
tree | 17c44d85ee1f122eab1d174b259443cc85560b84 /usr.sbin | |
parent | ba0213ec2a274732d843bec4d9c1cf76256848b4 (diff) |
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/bundle.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/datalink.c | 37 |
3 files changed, 24 insertions, 21 deletions
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index 0609bec9cff..589fe2b73f2 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: bundle.c,v 1.50 2001/01/29 01:34:38 brian Exp $ + * $OpenBSD: bundle.c,v 1.51 2001/02/04 01:14:23 brian Exp $ */ #include <sys/param.h> @@ -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; diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 41df51c19c8..7b0143f3737 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: command.c,v 1.56 2001/01/29 01:34:38 brian Exp $ + * $OpenBSD: command.c,v 1.57 2001/02/04 01:14:24 brian Exp $ * */ #include <sys/param.h> @@ -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 *); diff --git a/usr.sbin/ppp/ppp/datalink.c b/usr.sbin/ppp/ppp/datalink.c index 24f70ff0e85..74e41e3aa22 100644 --- a/usr.sbin/ppp/ppp/datalink.c +++ b/usr.sbin/ppp/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: datalink.c,v 1.33 2000/11/02 00:54:33 brian Exp $ + * $OpenBSD: datalink.c,v 1.34 2001/02/04 01:14:24 brian Exp $ */ #include <sys/param.h> @@ -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 |