summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-06-25 22:33:31 +0000
committerbrian <brian@FreeBSD.org>1998-06-25 22:33:31 +0000
commit1e23d0e92ca74f12045a6edbe3af1659468b1133 (patch)
tree3d61fb0aefd12cb54f86a51a4915c119627010a2 /usr.sbin
parentc957b12bc95bfb0a1df6e5625df47e96bdf7df94 (diff)
downloadFreeBSD-src-1e23d0e92ca74f12045a6edbe3af1659468b1133.zip
FreeBSD-src-1e23d0e92ca74f12045a6edbe3af1659468b1133.tar.gz
Add ``ipcp'' as an optional argument to ``open'', and make
open capable of re-negotiatiating the various layers. It is now possible to change various link options and then re-open the relevant layer, making the changes effective - for example, switching off VJ compression or starting ECHO LQRs on-the-fly.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ccp.c15
-rw-r--r--usr.sbin/ppp/command.c66
-rw-r--r--usr.sbin/ppp/datalink.c5
-rw-r--r--usr.sbin/ppp/fsm.c14
-rw-r--r--usr.sbin/ppp/fsm.h3
-rw-r--r--usr.sbin/ppp/ipcp.c20
-rw-r--r--usr.sbin/ppp/lcp.c3
-rw-r--r--usr.sbin/ppp/ppp.837
-rw-r--r--usr.sbin/ppp/ppp.8.m437
9 files changed, 143 insertions, 57 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index 086160e..5e164c22 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.33 1998/05/23 13:38:00 brian Exp $
+ * $Id: ccp.c,v 1.34 1998/06/15 19:06:02 brian Exp $
*
* TODO:
* o Support other compression protocols
@@ -306,13 +306,13 @@ CcpLayerStart(struct fsm *fp)
}
static void
-CcpLayerFinish(struct fsm *fp)
+CcpLayerDown(struct fsm *fp)
{
- /* We're now down */
+ /* About to come down */
struct ccp *ccp = fsm2ccp(fp);
struct ccp_opt *next;
- log_Printf(LogCCP, "%s: CcpLayerFinish.\n", fp->link->name);
+ log_Printf(LogCCP, "%s: CcpLayerDown.\n", fp->link->name);
if (ccp->in.state != NULL) {
(*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state);
ccp->in.state = NULL;
@@ -330,13 +330,14 @@ CcpLayerFinish(struct fsm *fp)
free(ccp->out.opt);
ccp->out.opt = next;
}
+ ccp_Setup(ccp);
}
static void
-CcpLayerDown(struct fsm *fp)
+CcpLayerFinish(struct fsm *fp)
{
- /* About to come down */
- log_Printf(LogCCP, "%s: CcpLayerDown.\n", fp->link->name);
+ /* We're now down */
+ log_Printf(LogCCP, "%s: CcpLayerFinish.\n", fp->link->name);
}
/*
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 11a06bc..702b4c8 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.147 1998/06/16 23:23:54 brian Exp $
+ * $Id: command.c,v 1.148 1998/06/20 00:19:33 brian Exp $
*
*/
#include <sys/types.h>
@@ -124,7 +124,7 @@
#define NEG_DNS 50
const char Version[] = "2.0-beta";
-const char VersionDate[] = "$Date: 1998/06/16 23:23:54 $";
+const char VersionDate[] = "$Date: 1998/06/20 00:19:33 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -470,7 +470,7 @@ static struct cmdtab const Commands[] = {
{"load", NULL, LoadCommand, LOCAL_AUTH | LOCAL_CX_OPT,
"Load settings", "load [remote]"},
{"open", NULL, OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT,
- "Open an FSM", "open [lcp|ccp]"},
+ "Open an FSM", "open [lcp|ccp|ipcp]"},
{"passwd", NULL, PasswdCommand, LOCAL_NO_AUTH,
"Password for manipulation", "passwd LocalPassword"},
{"quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
@@ -837,30 +837,48 @@ QuitCommand(struct cmdargs const *arg)
static int
OpenCommand(struct cmdargs const *arg)
{
- if (arg->argc == arg->argn ||
- (arg->argc == arg->argn+1 && !strcasecmp(arg->argv[arg->argn], "lcp")))
+ if (arg->argc == arg->argn)
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 link *l;
- struct fsm *fp;
+ else if (arg->argc == arg->argn + 1) {
+ if (!strcasecmp(arg->argv[arg->argn], "lcp")) {
+ if (arg->cx) {
+ if (arg->cx->physical->link.lcp.fsm.state == ST_OPENED)
+ fsm_Reopen(&arg->cx->physical->link.lcp.fsm);
+ else
+ bundle_Open(arg->bundle, arg->cx->name, PHYS_ALL);
+ } else
+ log_Printf(LogWARN, "open lcp: You must specify a link\n");
+ } else if (!strcasecmp(arg->argv[arg->argn], "ccp")) {
+ struct link *l;
+ struct fsm *fp;
- if (!(l = command_ChooseLink(arg)))
- return -1;
- fp = &l->ccp.fsm;
-
- if (fp->link->lcp.fsm.state != ST_OPENED)
- log_Printf(LogWARN, "open: LCP must be open before opening CCP\n");
- else if (fp->state != ST_OPENED) {
- fp->open_mode = 0; /* Not passive any more */
- if (fp->state == ST_STOPPED) {
- fsm_Down(fp);
- fsm_Up(fp);
- } else {
- fsm_Up(fp);
- fsm_Open(fp);
+ if (!(l = command_ChooseLink(arg)))
+ return -1;
+ fp = &l->ccp.fsm;
+
+ if (fp->link->lcp.fsm.state != ST_OPENED)
+ log_Printf(LogWARN, "open: LCP must be open before opening CCP\n");
+ else if (fp->state == ST_OPENED)
+ fsm_Reopen(fp);
+ else {
+ fp->open_mode = 0; /* Not passive any more */
+ if (fp->state == ST_STOPPED) {
+ fsm_Down(fp);
+ fsm_Up(fp);
+ } else {
+ fsm_Up(fp);
+ fsm_Open(fp);
+ }
}
- }
+ } else if (!strcasecmp(arg->argv[arg->argn], "ipcp")) {
+ if (arg->cx)
+ log_Printf(LogWARN, "open ipcp: You need not specify a link\n");
+ if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED)
+ fsm_Reopen(&arg->bundle->ncp.ipcp.fsm);
+ else
+ bundle_Open(arg->bundle, NULL, PHYS_ALL);
+ } else
+ return -1;
} else
return -1;
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c
index 1b36120..018df41 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.11 1998/06/20 00:19:35 brian Exp $
+ * $Id: datalink.c,v 1.12 1998/06/24 19:33:31 brian Exp $
*/
#include <sys/types.h>
@@ -483,7 +483,8 @@ datalink_AuthOk(struct datalink *dl)
}
} else if (bundle_Phase(dl->bundle) == PHASE_NETWORK) {
log_Printf(LogPHASE, "%s: Already in NETWORK phase\n", dl->name);
- datalink_AuthNotOk(dl);
+ datalink_NewState(dl, DATALINK_OPEN);
+ (*dl->parent->LayerUp)(dl->parent->object, &dl->physical->link.lcp.fsm);
return;
} else {
dl->bundle->ncp.mp.peer = dl->peer;
diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c
index 4174650..0ca6065 100644
--- a/usr.sbin/ppp/fsm.c
+++ b/usr.sbin/ppp/fsm.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: fsm.c,v 1.31 1998/06/20 00:19:36 brian Exp $
+ * $Id: fsm.c,v 1.32 1998/06/20 01:55:28 brian Exp $
*
* TODO:
*/
@@ -959,6 +959,18 @@ fsm_NullRecvResetAck(struct fsm *fp, u_char id)
}
void
+fsm_Reopen(struct fsm *fp)
+{
+ if (fp->state == ST_OPENED) {
+ (*fp->fn->LayerDown)(fp);
+ FsmInitRestartCounter(fp);
+ FsmSendConfigReq(fp);
+ NewState(fp, ST_REQSENT);
+ (*fp->parent->LayerDown)(fp->parent->object, fp);
+ }
+}
+
+void
fsm2initial(struct fsm *fp)
{
if (fp->state == ST_STOPPED)
diff --git a/usr.sbin/ppp/fsm.h b/usr.sbin/ppp/fsm.h
index c77fa8a..6a047ba 100644
--- a/usr.sbin/ppp/fsm.h
+++ b/usr.sbin/ppp/fsm.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: fsm.h,v 1.17 1998/05/21 21:45:26 brian Exp $
+ * $Id: fsm.h,v 1.18 1998/06/20 00:19:38 brian Exp $
*
* TODO:
*/
@@ -154,5 +154,6 @@ extern void fsm_Input(struct fsm *, struct mbuf *);
extern void fsm_Close(struct fsm *);
extern void fsm_NullRecvResetReq(struct fsm *);
extern void fsm_NullRecvResetAck(struct fsm *, u_char);
+extern void fsm_Reopen(struct fsm *);
extern void fsm2initial(struct fsm *);
extern const char *State2Nam(u_int);
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index da7b6cf..3310b81 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -17,10 +17,10 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.c,v 1.56 1998/06/15 19:06:12 brian Exp $
+ * $Id: ipcp.c,v 1.57 1998/06/16 19:40:38 brian Exp $
*
* TODO:
- * o More RFC1772 backwoard compatibility
+ * o More RFC1772 backward compatibility
*/
#include <sys/param.h>
#include <netinet/in_systm.h>
@@ -606,10 +606,14 @@ IpcpSendTerminateAck(struct fsm *fp, u_char id)
}
static void
-IpcpLayerStart(struct fsm * fp)
+IpcpLayerStart(struct fsm *fp)
{
/* We're about to start up ! */
+ struct ipcp *ipcp = fsm2ipcp(fp);
+
log_Printf(LogIPCP, "%s: IpcpLayerStart.\n", fp->link->name);
+ throughput_start(&ipcp->throughput, "IPCP throughput",
+ Enabled(fp->bundle, OPT_THROUGHPUT));
/* This is where we should be setting up the interface in AUTO mode */
}
@@ -618,7 +622,11 @@ static void
IpcpLayerFinish(struct fsm *fp)
{
/* We're now down */
+ struct ipcp *ipcp = fsm2ipcp(fp);
+
log_Printf(LogIPCP, "%s: IpcpLayerFinish.\n", fp->link->name);
+ throughput_stop(&ipcp->throughput);
+ throughput_log(&ipcp->throughput, LogIPCP, NULL);
}
void
@@ -670,8 +678,6 @@ IpcpLayerDown(struct fsm *fp)
s = inet_ntoa(ipcp->peer_ifip);
log_Printf(LogIPCP, "%s: IpcpLayerDown: %s\n", fp->link->name, s);
- throughput_stop(&ipcp->throughput);
- throughput_log(&ipcp->throughput, LogIPCP, NULL);
/*
* XXX this stuff should really live in the FSM. Our config should
* associate executable sections in files with events.
@@ -687,6 +693,8 @@ IpcpLayerDown(struct fsm *fp)
if (!(ipcp->fsm.bundle->phys_type.all & PHYS_AUTO))
ipcp_CleanInterface(ipcp);
+
+ ipcp_Setup(ipcp);
}
int
@@ -736,8 +744,6 @@ IpcpLayerUp(struct fsm *fp)
system_Select(fp->bundle, "MYADDR", LINKUPFILE, NULL, NULL);
}
- throughput_start(&ipcp->throughput, "IPCP throughput",
- Enabled(fp->bundle, OPT_THROUGHPUT));
log_DisplayPrompts();
return 1;
}
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c
index ddddfb9..81d086c 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.58 1998/05/29 18:32:40 brian Exp $
+ * $Id: lcp.c,v 1.59 1998/06/15 19:06:13 brian Exp $
*
* TODO:
* o Limit data field length by MRU
@@ -414,6 +414,7 @@ LcpLayerDown(struct fsm *fp)
log_Printf(LogLCP, "%s: LcpLayerDown\n", fp->link->name);
hdlc_StopTimer(&p->hdlc);
lqr_StopTimer(p);
+ lcp_Setup(fsm2lcp(fp), 0);
}
static void
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index bede94c..afff3e2 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.108 1998/06/18 01:24:29 brian Exp $
+.\" $Id: ppp.8,v 1.109 1998/06/21 11:14:50 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -2431,18 +2431,41 @@ file. If
is not given, the
.Ar default
label is used.
-.It open Op lcp|ccp
+.It open Op lcp|ccp|ipcp
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
+with no arguments is the same as using
.Dq dial
-in that all closed links are brought up. If the
+with no arguments, where all closed links are brought up.
+.Pp
+If the
+.Dq lcp
+option is used, the link will also be brought up. If however the LCP
+layer is already open, it will be renegotiated. This allows various
+LCP options to be changed, after which
+.Dq open lcp
+can be used to put them into effect. After renegotiating LCP,
+any agreed authentication will also take place.
+.Pp
+If the
.Dq ccp
-argument is used, the relevant compression layer is opened.
+argument is used, the relevant compression layer is opened. Again,
+if it is already open, it will be renegotiated.
+.Pp
+If the
+.Dq ipcp
+argument is used, the link will be brought up as with the
+.Dq lcp
+argument. If IPCP is already open, it will be renegotiated
+and the network interface will be reconfigured.
+.Pp
+It is probably not good practice to re-open the PPP state machines
+like this as it's possible that the peer will not behave correctly.
+It
+.Em is
+however useful as a way of forcing the CCP or VJ dictionaries to be reset.
.It passwd Ar pass
Specify the password required for access to the full
.Nm
diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4
index bede94c..afff3e2 100644
--- a/usr.sbin/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp.8.m4
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.108 1998/06/18 01:24:29 brian Exp $
+.\" $Id: ppp.8,v 1.109 1998/06/21 11:14:50 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -2431,18 +2431,41 @@ file. If
is not given, the
.Ar default
label is used.
-.It open Op lcp|ccp
+.It open Op lcp|ccp|ipcp
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
+with no arguments is the same as using
.Dq dial
-in that all closed links are brought up. If the
+with no arguments, where all closed links are brought up.
+.Pp
+If the
+.Dq lcp
+option is used, the link will also be brought up. If however the LCP
+layer is already open, it will be renegotiated. This allows various
+LCP options to be changed, after which
+.Dq open lcp
+can be used to put them into effect. After renegotiating LCP,
+any agreed authentication will also take place.
+.Pp
+If the
.Dq ccp
-argument is used, the relevant compression layer is opened.
+argument is used, the relevant compression layer is opened. Again,
+if it is already open, it will be renegotiated.
+.Pp
+If the
+.Dq ipcp
+argument is used, the link will be brought up as with the
+.Dq lcp
+argument. If IPCP is already open, it will be renegotiated
+and the network interface will be reconfigured.
+.Pp
+It is probably not good practice to re-open the PPP state machines
+like this as it's possible that the peer will not behave correctly.
+It
+.Em is
+however useful as a way of forcing the CCP or VJ dictionaries to be reset.
.It passwd Ar pass
Specify the password required for access to the full
.Nm
OpenPOWER on IntegriCloud