diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-06-20 00:19:42 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-06-20 00:19:42 +0000 |
commit | 09206a6f2a9728d53ca1ba4272ae7f4f02b67fac (patch) | |
tree | 1389dbbbcc44f007db1713f7da69e00fb1678387 /usr.sbin/ppp/datalink.c | |
parent | 2ed2c53bd8ebdac8bb8a43a99a0877ad326c5418 (diff) | |
download | src-09206a6f2a9728d53ca1ba4272ae7f4f02b67fac.tar.gz src-09206a6f2a9728d53ca1ba4272ae7f4f02b67fac.zip |
Create & use fsm2initial(), a function to bring a
state machine back to ST_INITIAL without going
through any unnecessary TLS/TLF pairs.
Notes
Notes:
svn path=/head/; revision=37060
Diffstat (limited to 'usr.sbin/ppp/datalink.c')
-rw-r--r-- | usr.sbin/ppp/datalink.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index b266c9e8da39..9923ec5e8ebe 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.c,v 1.9 1998/06/15 19:05:15 brian Exp $ + * $Id: datalink.c,v 1.10 1998/06/16 07:15:16 brian Exp $ */ #include <sys/types.h> @@ -512,8 +512,7 @@ datalink_LayerDown(void *v, struct fsm *fp) switch (dl->state) { case DATALINK_OPEN: peerid_Init(&dl->peer); - fsm_Down(&dl->physical->link.ccp.fsm); - fsm_Close(&dl->physical->link.ccp.fsm); + fsm2initial(&dl->physical->link.ccp.fsm); datalink_NewState(dl, DATALINK_LCP); /* before parent TLD */ (*dl->parent->LayerDown)(dl->parent->object, fp); /* fall through */ @@ -533,9 +532,7 @@ datalink_LayerFinish(void *v, struct fsm *fp) struct datalink *dl = (struct datalink *)v; if (fp->proto == PROTO_LCP) { - if (fp->state == ST_STOPPED) - fsm_Close(fp); /* back to CLOSED */ - fsm_Down(fp); /* Bring us to INITIAL or STARTING */ + fsm2initial(fp); (*dl->parent->LayerFinish)(dl->parent->object, fp); datalink_ComeDown(dl, CLOSE_NORMAL); } else if (fp->state == ST_CLOSED && fp->open_mode == OPEN_PASSIVE) @@ -740,8 +737,7 @@ datalink_Close(struct datalink *dl, int how) switch (dl->state) { case DATALINK_OPEN: peerid_Init(&dl->peer); - fsm_Down(&dl->physical->link.ccp.fsm); - fsm_Close(&dl->physical->link.ccp.fsm); + fsm2initial(&dl->physical->link.ccp.fsm); /* fall through */ case DATALINK_AUTH: @@ -767,19 +763,12 @@ datalink_Down(struct datalink *dl, int how) switch (dl->state) { case DATALINK_OPEN: peerid_Init(&dl->peer); - fsm_Down(&dl->physical->link.ccp.fsm); - fsm_Close(&dl->physical->link.ccp.fsm); + fsm2initial(&dl->physical->link.ccp.fsm); /* fall through */ case DATALINK_AUTH: case DATALINK_LCP: - if (dl->physical->link.lcp.fsm.state == ST_STOPPED) - fsm_Close(&dl->physical->link.lcp.fsm); /* back to CLOSED */ - fsm_Down(&dl->physical->link.lcp.fsm); - if (how != CLOSE_NORMAL) - fsm_Close(&dl->physical->link.lcp.fsm); - else - fsm_Open(&dl->physical->link.ccp.fsm); + fsm2initial(&dl->physical->link.lcp.fsm); /* fall through */ default: |