diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index bf4d0736f66d..3af2113891be 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.c,v 1.30.2.33 1998/04/07 00:53:22 brian Exp $ + * $Id: ccp.c,v 1.30.2.34 1998/04/16 00:25:50 brian Exp $ * * TODO: * o Support other compression protocols @@ -299,11 +299,14 @@ CcpLayerFinish(struct fsm *fp) if (ccp->in.state != NULL) { (*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state); ccp->in.state = NULL; + ccp->in.algorithm = -1; } if (ccp->out.state != NULL) { (*algorithm[ccp->out.algorithm]->o.Term)(ccp->out.state); ccp->out.state = NULL; + ccp->out.algorithm = -1; } + ccp->his_reject = ccp->my_reject = 0; } static void diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 6720191d12ae..3012a5625248 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.131.2.63 1998/04/17 22:05:12 brian Exp $ + * $Id: command.c,v 1.131.2.64 1998/04/18 01:01:17 brian Exp $ * */ #include @@ -123,6 +123,7 @@ static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); static int QuitCommand(struct cmdargs const *); +static int OpenCommand(struct cmdargs const *); static int CloseCommand(struct cmdargs const *); static int DownCommand(struct cmdargs const *); static int AllowCommand(struct cmdargs const *); @@ -256,8 +257,8 @@ DialCommand(struct cmdargs const *arg) if ((arg->cx && !(arg->cx->physical->type & (PHYS_MANUAL|PHYS_DEMAND))) || (!arg->cx && (arg->bundle->phys_type & ~(PHYS_MANUAL|PHYS_DEMAND)))) { - LogPrintf(LogWARN, - "Manual dial is only available in auto and interactive mode\n"); + LogPrintf(LogWARN, "Manual dial is only available for auto and" + " interactive links\n"); return 1; } @@ -408,7 +409,7 @@ static struct cmdtab const Commands[] = { {"clone", NULL, CloneCommand, LOCAL_AUTH | LOCAL_CX, "Clone a link", "clone newname..."}, {"close", NULL, CloseCommand, LOCAL_AUTH | LOCAL_CX_OPT, - "Close connection", "close"}, + "Close an FSM", "close [lcp|ccp]"}, {"delete", NULL, DeleteCommand, LOCAL_AUTH, "delete route", "delete dest", NULL}, {NULL, "delete!", DeleteCommand, LOCAL_AUTH, @@ -427,6 +428,8 @@ static struct cmdtab const Commands[] = { "Link specific commands", "link name command ..."}, {"load", NULL, LoadCommand, LOCAL_AUTH, "Load settings", "load [remote]"}, + {"open", NULL, OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT, + "Open an FSM", "open [lcp|ccp]"}, {"passwd", NULL, PasswdCommand, LOCAL_NO_AUTH, "Password for manipulation", "passwd LocalPassword"}, {"quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH, @@ -500,7 +503,7 @@ static int ShowVersion(struct cmdargs const *arg) { static char VarVersion[] = "PPP Version 2.0-beta"; - static char VarLocalVersion[] = "$Date: 1998/04/17 22:05:12 $"; + static char VarLocalVersion[] = "$Date: 1998/04/18 01:01:17 $"; prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion); return 0; @@ -782,10 +785,41 @@ QuitCommand(struct cmdargs const *arg) return 0; } +static int +OpenCommand(struct cmdargs const *arg) +{ + if (arg->argc == arg->argn || + (arg->argc == arg->argn+1 && !strcasecmp(arg->argv[arg->argn], "lcp"))) + bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL); + else if (arg->argc == arg->argn+1 && + !strcasecmp(arg->argv[arg->argn], "ccp")) { + struct fsm *fp = &ChooseLink(arg)->ccp.fsm; + + if (fp->state != ST_OPENED) { + FsmUp(fp); + FsmOpen(fp); + } + } else + return -1; + + return 0; +} + static int CloseCommand(struct cmdargs const *arg) { - bundle_Close(arg->bundle, arg->cx ? arg->cx->name : NULL, 1); + if (arg->argc == arg->argn || + (arg->argc == arg->argn+1 && !strcasecmp(arg->argv[arg->argn], "lcp"))) + bundle_Close(arg->bundle, arg->cx ? arg->cx->name : NULL, 1); + else if (arg->argc == arg->argn+1 && + !strcasecmp(arg->argv[arg->argn], "ccp")) { + struct fsm *fp = &ChooseLink(arg)->ccp.fsm; + + if (fp->state == ST_OPENED) + FsmClose(fp); + } else + return -1; + return 0; } diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 383bd2127771..96c40345c4ce 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.97.2.17 1998/04/16 18:30:54 brian Exp $ +.\" $Id: ppp.8,v 1.97.2.18 1998/04/17 22:05:37 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -2100,8 +2100,15 @@ command below. It is only available in multilink mode. Links may be removed using the .Dq remove command below. -.It close -Close the current connection (but don't quit). +.It close Op lcp|ccp +If no arguments are given, or if +.Dq lcp +is specified, the link will be closed. If +.Dq ccp +is specified, only the relevent compression layer is closed. Either way, +this command does not disconnect the user from ppp or exit ppp. See the +.Dq quit +command below. .It delete[!] Ar dest This command deletes the route with the given .Ar dest @@ -2162,6 +2169,18 @@ file. If is not given, the .Ar default label is used. +.It open Op lcp|ccp +This is the opposite of the +.Dq close +command. Using +.Dq open +with no arguments or with the +.Dq lcp +argument is the same as using +.Dq dial +in that all configured links are brought up. If the +.Dq ccp +argument is used, the relevent compression layer is opened. .It passwd Ar pass Specify the password required for access to the full .Nm