Expand the "set stopped" command so that it can
idependently time out any of the FSMs. Split LCP logging into LCP, IPCP and CCP logging, and make room in "struct fsm" for the log level that the state machine should use.
This commit is contained in:
parent
f28d374978
commit
ee30a80360
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: ccp.c,v 1.12 1997/05/26 00:43:56 brian Exp $
|
* $Id: ccp.c,v 1.13 1997/06/09 03:27:14 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o Support other compression protocols
|
* o Support other compression protocols
|
||||||
@ -52,9 +52,10 @@ struct fsm CcpFsm = {
|
|||||||
OPEN_ACTIVE,
|
OPEN_ACTIVE,
|
||||||
ST_INITIAL,
|
ST_INITIAL,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
|
|
||||||
0,
|
0,
|
||||||
{ 0, 0, 0, NULL, NULL, NULL },
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
LogCCP,
|
||||||
|
|
||||||
CcpLayerUp,
|
CcpLayerUp,
|
||||||
CcpLayerDown,
|
CcpLayerDown,
|
||||||
@ -120,7 +121,7 @@ struct fsm *fp;
|
|||||||
struct ccpstate *icp = &CcpInfo;
|
struct ccpstate *icp = &CcpInfo;
|
||||||
|
|
||||||
cp = ReqBuff;
|
cp = ReqBuff;
|
||||||
LogPrintf(LogLCP, "CcpSendConfigReq\n");
|
LogPrintf(LogCCP, "CcpSendConfigReq\n");
|
||||||
if (icp->want_proto && !REJECTED(icp, TY_PRED1)) {
|
if (icp->want_proto && !REJECTED(icp, TY_PRED1)) {
|
||||||
*cp++ = TY_PRED1; *cp++ = 2;
|
*cp++ = TY_PRED1; *cp++ = 2;
|
||||||
}
|
}
|
||||||
@ -132,7 +133,7 @@ CcpSendResetReq(fp)
|
|||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
Pred1Init(1); /* Initialize Input part */
|
Pred1Init(1); /* Initialize Input part */
|
||||||
LogPrintf(LogLCP, "CcpSendResetReq\n");
|
LogPrintf(LogCCP, "CcpSendResetReq\n");
|
||||||
FsmOutput(fp, CODE_RESETREQ, fp->reqid, NULL, 0);
|
FsmOutput(fp, CODE_RESETREQ, fp->reqid, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ static void
|
|||||||
CcpSendTerminateAck(fp)
|
CcpSendTerminateAck(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "CcpSendTerminateAck\n");
|
LogPrintf(LogCCP, "CcpSendTerminateAck\n");
|
||||||
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
|
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,21 +163,21 @@ static void
|
|||||||
CcpLayerStart(fp)
|
CcpLayerStart(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "CcpLayerStart.\n");
|
LogPrintf(LogCCP, "CcpLayerStart.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CcpLayerFinish(fp)
|
CcpLayerFinish(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "CcpLayerFinish.\n");
|
LogPrintf(LogCCP, "CcpLayerFinish.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CcpLayerDown(fp)
|
CcpLayerDown(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "CcpLayerDown.\n");
|
LogPrintf(LogCCP, "CcpLayerDown.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -186,8 +187,8 @@ static void
|
|||||||
CcpLayerUp(fp)
|
CcpLayerUp(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "CcpLayerUp(%d).\n", fp->state);
|
LogPrintf(LogCCP, "CcpLayerUp(%d).\n", fp->state);
|
||||||
LogPrintf(LogLCP, "myproto = %d, hisproto = %d\n",
|
LogPrintf(LogCCP, "myproto = %d, hisproto = %d\n",
|
||||||
CcpInfo.want_proto, CcpInfo.his_proto);
|
CcpInfo.want_proto, CcpInfo.his_proto);
|
||||||
Pred1Init(3); /* Initialize Input and Output */
|
Pred1Init(3); /* Initialize Input and Output */
|
||||||
}
|
}
|
||||||
@ -196,7 +197,7 @@ void
|
|||||||
CcpUp()
|
CcpUp()
|
||||||
{
|
{
|
||||||
FsmUp(&CcpFsm);
|
FsmUp(&CcpFsm);
|
||||||
LogPrintf(LogLCP, "CCP Up event!!\n");
|
LogPrintf(LogCCP, "CCP Up event!!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -229,7 +230,7 @@ int mode;
|
|||||||
else
|
else
|
||||||
snprintf(tbuff, sizeof(tbuff), " ");
|
snprintf(tbuff, sizeof(tbuff), " ");
|
||||||
|
|
||||||
LogPrintf(LogLCP, "%s\n", tbuff);
|
LogPrintf(LogCCP, "%s\n", tbuff);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TY_PRED1:
|
case TY_PRED1:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: command.c,v 1.69 1997/08/18 20:15:09 brian Exp $
|
* $Id: command.c,v 1.70 1997/08/19 01:10:19 brian Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -415,10 +415,27 @@ static int ShowStopped()
|
|||||||
{
|
{
|
||||||
if (!VarTerm)
|
if (!VarTerm)
|
||||||
return 0;
|
return 0;
|
||||||
if (!VarStoppedTimeout)
|
|
||||||
fprintf(VarTerm, " Stopped Timer: Disabled\n");
|
fprintf(VarTerm, " Stopped Timer: LCP: ");
|
||||||
|
if (!LcpFsm.StoppedTimer.load)
|
||||||
|
fprintf(VarTerm, "Disabled");
|
||||||
else
|
else
|
||||||
fprintf(VarTerm, " Stopped Timer: %d secs\n", VarStoppedTimeout);
|
fprintf(VarTerm, "%ld secs", LcpFsm.StoppedTimer.load / SECTICKS);
|
||||||
|
|
||||||
|
fprintf(VarTerm, ", IPCP: ");
|
||||||
|
if (!IpcpFsm.StoppedTimer.load)
|
||||||
|
fprintf(VarTerm, "Disabled");
|
||||||
|
else
|
||||||
|
fprintf(VarTerm, "%ld secs", IpcpFsm.StoppedTimer.load / SECTICKS);
|
||||||
|
|
||||||
|
fprintf(VarTerm, ", CCP: ");
|
||||||
|
if (!CcpFsm.StoppedTimer.load)
|
||||||
|
fprintf(VarTerm, "Disabled");
|
||||||
|
else
|
||||||
|
fprintf(VarTerm, "%ld secs", CcpFsm.StoppedTimer.load / SECTICKS);
|
||||||
|
|
||||||
|
fprintf(VarTerm, "\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -887,8 +904,18 @@ struct cmdtab *list;
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
LcpFsm.StoppedTimer.load = 0;
|
||||||
VarStoppedTimeout = atoi(argv[0]);
|
IpcpFsm.StoppedTimer.load = 0;
|
||||||
|
CcpFsm.StoppedTimer.load = 0;
|
||||||
|
if (argc <= 3) {
|
||||||
|
if (argc > 0) {
|
||||||
|
LcpFsm.StoppedTimer.load = atoi(argv[0]) * SECTICKS;
|
||||||
|
if (argc > 1) {
|
||||||
|
IpcpFsm.StoppedTimer.load = atoi(argv[1]) * SECTICKS;
|
||||||
|
if (argc > 2)
|
||||||
|
CcpFsm.StoppedTimer.load = atoi(argv[2]) * SECTICKS;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: fsm.c,v 1.13 1997/06/09 03:27:21 brian Exp $
|
* $Id: fsm.c,v 1.14 1997/08/17 20:45:46 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o Refer loglevel for log output
|
* o Refer loglevel for log output
|
||||||
@ -43,23 +43,11 @@ char const *StateNames[] = {
|
|||||||
"Req-Sent", "Ack-Rcvd", "Ack-Sent", "Opened",
|
"Req-Sent", "Ack-Rcvd", "Ack-Sent", "Opened",
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* This timer times the ST_STOPPED state out after the given value
|
|
||||||
* (specified via "set stopped ..."). Although this isn't
|
|
||||||
* specified in the rfc, the rfc *does* say that "the application
|
|
||||||
* may use higher level timers to avoid deadlock".
|
|
||||||
* The StoppedTimer takes effect when the other side ABENDs rather
|
|
||||||
* than going into ST_ACKSENT (and sending the ACK), causing ppp to
|
|
||||||
* time out and drop into ST_STOPPED. At this point, nothing will
|
|
||||||
* change this state :-(
|
|
||||||
*/
|
|
||||||
struct pppTimer StoppedTimer;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
StoppedTimeout(fp)
|
StoppedTimeout(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "Stopped timer expired\n");
|
LogPrintf(fp->LogLevel, "Stopped timer expired\n");
|
||||||
if (modem != -1)
|
if (modem != -1)
|
||||||
DownConnection();
|
DownConnection();
|
||||||
else
|
else
|
||||||
@ -82,19 +70,18 @@ NewState(fp, new)
|
|||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
int new;
|
int new;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "State change %s --> %s\n",
|
LogPrintf(fp->LogLevel, "State change %s --> %s\n",
|
||||||
StateNames[fp->state], StateNames[new]);
|
StateNames[fp->state], StateNames[new]);
|
||||||
if (fp->state == ST_STOPPED && StoppedTimer.state == TIMER_RUNNING)
|
if (fp->state == ST_STOPPED && fp->StoppedTimer.state == TIMER_RUNNING)
|
||||||
StopTimer(&StoppedTimer);
|
StopTimer(&fp->StoppedTimer);
|
||||||
fp->state = new;
|
fp->state = new;
|
||||||
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED)) {
|
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED)) {
|
||||||
StopTimer(&fp->FsmTimer);
|
StopTimer(&fp->FsmTimer);
|
||||||
if (new == ST_STOPPED && VarStoppedTimeout) {
|
if (new == ST_STOPPED && fp->StoppedTimer.load) {
|
||||||
StoppedTimer.state = TIMER_STOPPED;
|
fp->StoppedTimer.state = TIMER_STOPPED;
|
||||||
StoppedTimer.func = StoppedTimeout;
|
fp->StoppedTimer.func = StoppedTimeout;
|
||||||
StoppedTimer.arg = (void *)fp;
|
fp->StoppedTimer.arg = (void *)fp;
|
||||||
StoppedTimer.load = VarStoppedTimeout * SECTICKS;
|
StartTimer(&fp->StoppedTimer);
|
||||||
StartTimer(&StoppedTimer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +156,7 @@ struct fsm *fp;
|
|||||||
NewState(fp, ST_REQSENT);
|
NewState(fp, ST_REQSENT);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogPrintf(LogLCP, "Oops, Up at %s\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "Oops, Up at %s\n", StateNames[fp->state]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +233,7 @@ void
|
|||||||
FsmSendTerminateReq(fp)
|
FsmSendTerminateReq(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "SendTerminateReq.\n");
|
LogPrintf(fp->LogLevel, "SendTerminateReq.\n");
|
||||||
FsmOutput(fp, CODE_TERMREQ, fp->reqid++, NULL, 0);
|
FsmOutput(fp, CODE_TERMREQ, fp->reqid++, NULL, 0);
|
||||||
(fp->SendTerminateReq)(fp);
|
(fp->SendTerminateReq)(fp);
|
||||||
StartTimer(&fp->FsmTimer); /* Start restart timer */
|
StartTimer(&fp->FsmTimer); /* Start restart timer */
|
||||||
@ -260,7 +247,7 @@ struct fsmheader *lhp;
|
|||||||
u_char *option;
|
u_char *option;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "SendConfigAck(%s)\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "SendConfigAck(%s)\n", StateNames[fp->state]);
|
||||||
(fp->DecodeConfig)(option, count, MODE_NOP);
|
(fp->DecodeConfig)(option, count, MODE_NOP);
|
||||||
FsmOutput(fp, CODE_CONFIGACK, lhp->id, option, count);
|
FsmOutput(fp, CODE_CONFIGACK, lhp->id, option, count);
|
||||||
}
|
}
|
||||||
@ -272,7 +259,7 @@ struct fsmheader *lhp;
|
|||||||
u_char *option;
|
u_char *option;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "SendConfigRej(%s)\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "SendConfigRej(%s)\n", StateNames[fp->state]);
|
||||||
(fp->DecodeConfig)(option, count, MODE_NOP);
|
(fp->DecodeConfig)(option, count, MODE_NOP);
|
||||||
FsmOutput(fp, CODE_CONFIGREJ, lhp->id, option, count);
|
FsmOutput(fp, CODE_CONFIGREJ, lhp->id, option, count);
|
||||||
}
|
}
|
||||||
@ -284,7 +271,7 @@ struct fsmheader *lhp;
|
|||||||
u_char *option;
|
u_char *option;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "SendConfigNak(%s)\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "SendConfigNak(%s)\n", StateNames[fp->state]);
|
||||||
(fp->DecodeConfig)(option, count, MODE_NOP);
|
(fp->DecodeConfig)(option, count, MODE_NOP);
|
||||||
FsmOutput(fp, CODE_CONFIGNAK, lhp->id, option, count);
|
FsmOutput(fp, CODE_CONFIGNAK, lhp->id, option, count);
|
||||||
}
|
}
|
||||||
@ -370,7 +357,7 @@ struct mbuf *bp;
|
|||||||
switch (fp->state) {
|
switch (fp->state) {
|
||||||
case ST_INITIAL:
|
case ST_INITIAL:
|
||||||
case ST_STARTING:
|
case ST_STARTING:
|
||||||
LogPrintf(LogLCP, "Oops, RCR in %s.\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "Oops, RCR in %s.\n", StateNames[fp->state]);
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
return;
|
return;
|
||||||
case ST_CLOSED:
|
case ST_CLOSED:
|
||||||
@ -490,7 +477,7 @@ struct mbuf *bp;
|
|||||||
switch (fp->state) {
|
switch (fp->state) {
|
||||||
case ST_INITIAL:
|
case ST_INITIAL:
|
||||||
case ST_STARTING:
|
case ST_STARTING:
|
||||||
LogPrintf(LogLCP, "Oops, RCN in %s.\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "Oops, RCN in %s.\n", StateNames[fp->state]);
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
return;
|
return;
|
||||||
case ST_CLOSED:
|
case ST_CLOSED:
|
||||||
@ -533,7 +520,7 @@ struct mbuf *bp;
|
|||||||
switch (fp->state) {
|
switch (fp->state) {
|
||||||
case ST_INITIAL:
|
case ST_INITIAL:
|
||||||
case ST_STARTING:
|
case ST_STARTING:
|
||||||
LogPrintf(LogLCP, "Oops, RTR in %s\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "Oops, RTR in %s\n", StateNames[fp->state]);
|
||||||
break;
|
break;
|
||||||
case ST_CLOSED:
|
case ST_CLOSED:
|
||||||
case ST_STOPPED:
|
case ST_STOPPED:
|
||||||
@ -599,7 +586,7 @@ struct mbuf *bp;
|
|||||||
pfree(bp);
|
pfree(bp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LogPrintf(LogLCP, "RecvConfigRej.\n");
|
LogPrintf(fp->LogLevel, "RecvConfigRej.\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check and process easy case
|
* Check and process easy case
|
||||||
@ -607,7 +594,7 @@ struct mbuf *bp;
|
|||||||
switch (fp->state) {
|
switch (fp->state) {
|
||||||
case ST_INITIAL:
|
case ST_INITIAL:
|
||||||
case ST_STARTING:
|
case ST_STARTING:
|
||||||
LogPrintf(LogLCP, "Oops, RCJ in %s.\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "Oops, RCJ in %s.\n", StateNames[fp->state]);
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
return;
|
return;
|
||||||
case ST_CLOSED:
|
case ST_CLOSED:
|
||||||
@ -646,7 +633,7 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvCodeRej\n");
|
LogPrintf(fp->LogLevel, "RecvCodeRej\n");
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +647,7 @@ struct mbuf *bp;
|
|||||||
|
|
||||||
sp = (u_short *)MBUF_CTOP(bp);
|
sp = (u_short *)MBUF_CTOP(bp);
|
||||||
proto = ntohs(*sp);
|
proto = ntohs(*sp);
|
||||||
LogPrintf(LogLCP, "-- Protocol (%04x) was rejected.\n", proto);
|
LogPrintf(fp->LogLevel, "-- Protocol (%04x) was rejected.\n", proto);
|
||||||
|
|
||||||
switch (proto) {
|
switch (proto) {
|
||||||
case PROTO_LQR:
|
case PROTO_LQR:
|
||||||
@ -701,7 +688,7 @@ struct mbuf *bp;
|
|||||||
|
|
||||||
if (fp->state == ST_OPENED) {
|
if (fp->state == ST_OPENED) {
|
||||||
*lp = htonl(LcpInfo.want_magic); /* Insert local magic number */
|
*lp = htonl(LcpInfo.want_magic); /* Insert local magic number */
|
||||||
LogPrintf(LogLCP, "SendEchoRep(%s)\n", StateNames[fp->state]);
|
LogPrintf(fp->LogLevel, "SendEchoRep(%s)\n", StateNames[fp->state]);
|
||||||
FsmOutput(fp, CODE_ECHOREP, lhp->id, cp, plength(bp));
|
FsmOutput(fp, CODE_ECHOREP, lhp->id, cp, plength(bp));
|
||||||
}
|
}
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
@ -738,7 +725,7 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvDiscReq\n");
|
LogPrintf(fp->LogLevel, "RecvDiscReq\n");
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +735,7 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvIdent\n");
|
LogPrintf(fp->LogLevel, "RecvIdent\n");
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +745,7 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvTimeRemain\n");
|
LogPrintf(fp->LogLevel, "RecvTimeRemain\n");
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,9 +755,9 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvResetReq\n");
|
LogPrintf(fp->LogLevel, "RecvResetReq\n");
|
||||||
CcpRecvResetReq(fp);
|
CcpRecvResetReq(fp);
|
||||||
LogPrintf(LogLCP, "SendResetAck\n");
|
LogPrintf(fp->LogLevel, "SendResetAck\n");
|
||||||
FsmOutput(fp, CODE_RESETACK, fp->reqid, NULL, 0);
|
FsmOutput(fp, CODE_RESETACK, fp->reqid, NULL, 0);
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
@ -781,7 +768,7 @@ struct fsm *fp;
|
|||||||
struct fsmheader *lhp;
|
struct fsmheader *lhp;
|
||||||
struct mbuf *bp;
|
struct mbuf *bp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "RecvResetAck\n");
|
LogPrintf(fp->LogLevel, "RecvResetAck\n");
|
||||||
fp->reqid++;
|
fp->reqid++;
|
||||||
pfree(bp);
|
pfree(bp);
|
||||||
}
|
}
|
||||||
@ -828,7 +815,7 @@ struct mbuf *bp;
|
|||||||
bp->cnt -= sizeof(struct fsmheader);
|
bp->cnt -= sizeof(struct fsmheader);
|
||||||
|
|
||||||
codep = FsmCodes + lhp->code - 1;
|
codep = FsmCodes + lhp->code - 1;
|
||||||
LogPrintf(LogLCP, "Received %s (%d) state = %s (%d)\n",
|
LogPrintf(fp->LogLevel, "Received %s (%d) state = %s (%d)\n",
|
||||||
codep->name, lhp->id, StateNames[fp->state], fp->state);
|
codep->name, lhp->id, StateNames[fp->state], fp->state);
|
||||||
if (LogIsKept(LogDEBUG))
|
if (LogIsKept(LogDEBUG))
|
||||||
LogMemory();
|
LogMemory();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: fsm.h,v 1.7 1997/02/22 16:10:14 peter Exp $
|
* $Id: fsm.h,v 1.8 1997/06/09 03:27:21 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -65,6 +65,19 @@ struct fsm {
|
|||||||
int reqcode; /* Request code sent */
|
int reqcode; /* Request code sent */
|
||||||
struct pppTimer FsmTimer; /* Restart Timer */
|
struct pppTimer FsmTimer; /* Restart Timer */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This timer times the ST_STOPPED state out after the given value
|
||||||
|
* (specified via "set stopped ..."). Although this isn't
|
||||||
|
* specified in the rfc, the rfc *does* say that "the application
|
||||||
|
* may use higher level timers to avoid deadlock".
|
||||||
|
* The StoppedTimer takes effect when the other side ABENDs rather
|
||||||
|
* than going into ST_ACKSENT (and sending the ACK), causing ppp to
|
||||||
|
* time out and drop into ST_STOPPED. At this point, nothing will
|
||||||
|
* change this state :-(
|
||||||
|
*/
|
||||||
|
struct pppTimer StoppedTimer;
|
||||||
|
int LogLevel;
|
||||||
|
|
||||||
void (*LayerUp)(struct fsm *);
|
void (*LayerUp)(struct fsm *);
|
||||||
void (*LayerDown)(struct fsm *);
|
void (*LayerDown)(struct fsm *);
|
||||||
void (*LayerStart)(struct fsm *);
|
void (*LayerStart)(struct fsm *);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: ipcp.c,v 1.23 1997/07/29 22:37:04 brian Exp $
|
* $Id: ipcp.c,v 1.24 1997/08/19 01:10:20 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o More RFC1772 backwoard compatibility
|
* o More RFC1772 backwoard compatibility
|
||||||
@ -76,6 +76,8 @@ struct fsm IpcpFsm = {
|
|||||||
|
|
||||||
0,
|
0,
|
||||||
{ 0, 0, 0, NULL, NULL, NULL },
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
LogIPCP,
|
||||||
|
|
||||||
IpcpLayerUp,
|
IpcpLayerUp,
|
||||||
IpcpLayerDown,
|
IpcpLayerDown,
|
||||||
@ -187,7 +189,7 @@ IpcpInit()
|
|||||||
*/
|
*/
|
||||||
if (HaveTriggerAddress) {
|
if (HaveTriggerAddress) {
|
||||||
icp->want_ipaddr.s_addr = TriggerAddress.s_addr;
|
icp->want_ipaddr.s_addr = TriggerAddress.s_addr;
|
||||||
LogPrintf(LogLCP, "Using trigger address %s\n", inet_ntoa(TriggerAddress));
|
LogPrintf(LogIPCP, "Using trigger address %s\n", inet_ntoa(TriggerAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enabled(ConfVjcomp))
|
if (Enabled(ConfVjcomp))
|
||||||
@ -214,7 +216,7 @@ struct fsm *fp;
|
|||||||
struct ipcpstate *icp = &IpcpInfo;
|
struct ipcpstate *icp = &IpcpInfo;
|
||||||
|
|
||||||
cp = ReqBuff;
|
cp = ReqBuff;
|
||||||
LogPrintf(LogLCP, "IpcpSendConfigReq\n");
|
LogPrintf(LogIPCP, "IpcpSendConfigReq\n");
|
||||||
if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR))
|
if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR))
|
||||||
PutConfValue(&cp, cftypes, TY_IPADDR, 6, ntohl(icp->want_ipaddr.s_addr));
|
PutConfValue(&cp, cftypes, TY_IPADDR, 6, ntohl(icp->want_ipaddr.s_addr));
|
||||||
if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) {
|
if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) {
|
||||||
@ -237,7 +239,7 @@ static void
|
|||||||
IpcpSendTerminateAck(fp)
|
IpcpSendTerminateAck(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "IpcpSendTerminateAck\n");
|
LogPrintf(LogIPCP, "IpcpSendTerminateAck\n");
|
||||||
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
|
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,14 +247,14 @@ static void
|
|||||||
IpcpLayerStart(fp)
|
IpcpLayerStart(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "IpcpLayerStart.\n");
|
LogPrintf(LogIPCP, "IpcpLayerStart.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
IpcpLayerFinish(fp)
|
IpcpLayerFinish(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "IpcpLayerFinish.\n");
|
LogPrintf(LogIPCP, "IpcpLayerFinish.\n");
|
||||||
reconnect(RECON_FALSE);
|
reconnect(RECON_FALSE);
|
||||||
LcpClose();
|
LcpClose();
|
||||||
NewPhase(PHASE_TERMINATE);
|
NewPhase(PHASE_TERMINATE);
|
||||||
@ -262,7 +264,7 @@ static void
|
|||||||
IpcpLayerDown(fp)
|
IpcpLayerDown(fp)
|
||||||
struct fsm *fp;
|
struct fsm *fp;
|
||||||
{
|
{
|
||||||
LogPrintf(LogLCP, "IpcpLayerDown.\n");
|
LogPrintf(LogIPCP, "IpcpLayerDown.\n");
|
||||||
StopTimer(&IpcpReportTimer);
|
StopTimer(&IpcpReportTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,10 +278,10 @@ struct fsm *fp;
|
|||||||
char tbuff[100];
|
char tbuff[100];
|
||||||
|
|
||||||
Prompt();
|
Prompt();
|
||||||
LogPrintf(LogLCP, "IpcpLayerUp(%d).\n", fp->state);
|
LogPrintf(LogIPCP, "IpcpLayerUp(%d).\n", fp->state);
|
||||||
snprintf(tbuff, sizeof(tbuff), "myaddr = %s ",
|
snprintf(tbuff, sizeof(tbuff), "myaddr = %s ",
|
||||||
inet_ntoa(IpcpInfo.want_ipaddr));
|
inet_ntoa(IpcpInfo.want_ipaddr));
|
||||||
LogPrintf(LogIsKept(LogLCP) ? LogLCP : LogLINK, " %s hisaddr = %s\n",
|
LogPrintf(LogIsKept(LogIPCP) ? LogIPCP : LogLINK, " %s hisaddr = %s\n",
|
||||||
tbuff, inet_ntoa(IpcpInfo.his_ipaddr));
|
tbuff, inet_ntoa(IpcpInfo.his_ipaddr));
|
||||||
if (OsSetIpaddress(IpcpInfo.want_ipaddr, IpcpInfo.his_ipaddr, ifnetmask) < 0) {
|
if (OsSetIpaddress(IpcpInfo.want_ipaddr, IpcpInfo.his_ipaddr, ifnetmask) < 0) {
|
||||||
if (VarTerm)
|
if (VarTerm)
|
||||||
@ -297,7 +299,7 @@ void
|
|||||||
IpcpUp()
|
IpcpUp()
|
||||||
{
|
{
|
||||||
FsmUp(&IpcpFsm);
|
FsmUp(&IpcpFsm);
|
||||||
LogPrintf(LogLCP, "IPCP Up event!!\n");
|
LogPrintf(LogIPCP, "IPCP Up event!!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -351,7 +353,7 @@ int mode;
|
|||||||
case TY_IPADDR: /* RFC1332 */
|
case TY_IPADDR: /* RFC1332 */
|
||||||
lp = (u_long *)(cp + 2);
|
lp = (u_long *)(cp + 2);
|
||||||
ipaddr.s_addr = *lp;
|
ipaddr.s_addr = *lp;
|
||||||
LogPrintf(LogLCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
|
LogPrintf(LogIPCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_REQ:
|
case MODE_REQ:
|
||||||
@ -376,7 +378,7 @@ int mode;
|
|||||||
* Use address suggested by peer.
|
* Use address suggested by peer.
|
||||||
*/
|
*/
|
||||||
snprintf(tbuff2, sizeof(tbuff2), "%s changing address: %s ", tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
|
snprintf(tbuff2, sizeof(tbuff2), "%s changing address: %s ", tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
|
||||||
LogPrintf(LogLCP, "%s --> %s\n", tbuff2, inet_ntoa(ipaddr));
|
LogPrintf(LogIPCP, "%s --> %s\n", tbuff2, inet_ntoa(ipaddr));
|
||||||
IpcpInfo.want_ipaddr = ipaddr;
|
IpcpInfo.want_ipaddr = ipaddr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -388,7 +390,7 @@ int mode;
|
|||||||
case TY_COMPPROTO:
|
case TY_COMPPROTO:
|
||||||
lp = (u_long *)(cp + 2);
|
lp = (u_long *)(cp + 2);
|
||||||
compproto = htonl(*lp);
|
compproto = htonl(*lp);
|
||||||
LogPrintf(LogLCP, "%s %08x\n", tbuff, compproto);
|
LogPrintf(LogIPCP, "%s %08x\n", tbuff, compproto);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_REQ:
|
case MODE_REQ:
|
||||||
@ -436,7 +438,7 @@ int mode;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MODE_NAK:
|
case MODE_NAK:
|
||||||
LogPrintf(LogLCP, "%s changing compproto: %08x --> %08x\n",
|
LogPrintf(LogIPCP, "%s changing compproto: %08x --> %08x\n",
|
||||||
tbuff, IpcpInfo.want_compproto, compproto);
|
tbuff, IpcpInfo.want_compproto, compproto);
|
||||||
IpcpInfo.want_compproto = compproto;
|
IpcpInfo.want_compproto = compproto;
|
||||||
break;
|
break;
|
||||||
@ -450,8 +452,8 @@ int mode;
|
|||||||
ipaddr.s_addr = *lp;
|
ipaddr.s_addr = *lp;
|
||||||
lp = (u_long *)(cp + 6);
|
lp = (u_long *)(cp + 6);
|
||||||
dstipaddr.s_addr = *lp;
|
dstipaddr.s_addr = *lp;
|
||||||
LogPrintf(LogLCP, "%s %s, ", tbuff, inet_ntoa(ipaddr));
|
LogPrintf(LogIPCP, "%s %s, ", tbuff, inet_ntoa(ipaddr));
|
||||||
LogPrintf(LogLCP, "%s\n", inet_ntoa(dstipaddr));
|
LogPrintf(LogIPCP, "%s\n", inet_ntoa(dstipaddr));
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_REQ:
|
case MODE_REQ:
|
||||||
@ -461,9 +463,9 @@ int mode;
|
|||||||
ackp += length;
|
ackp += length;
|
||||||
break;
|
break;
|
||||||
case MODE_NAK:
|
case MODE_NAK:
|
||||||
LogPrintf(LogLCP, "%s changing address: %s ",
|
LogPrintf(LogIPCP, "%s changing address: %s ",
|
||||||
tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
|
tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
|
||||||
LogPrintf(LogLCP, "--> %s\n", inet_ntoa(ipaddr));
|
LogPrintf(LogIPCP, "--> %s\n", inet_ntoa(ipaddr));
|
||||||
IpcpInfo.want_ipaddr = ipaddr;
|
IpcpInfo.want_ipaddr = ipaddr;
|
||||||
IpcpInfo.his_ipaddr = dstipaddr;
|
IpcpInfo.his_ipaddr = dstipaddr;
|
||||||
break;
|
break;
|
||||||
@ -481,7 +483,7 @@ int mode;
|
|||||||
case TY_PRIMARY_DNS: /* MS PPP DNS negotiation hack */
|
case TY_PRIMARY_DNS: /* MS PPP DNS negotiation hack */
|
||||||
case TY_SECONDARY_DNS:
|
case TY_SECONDARY_DNS:
|
||||||
if( !Enabled( ConfMSExt ) ) {
|
if( !Enabled( ConfMSExt ) ) {
|
||||||
LogPrintf(LogLCP, "MS NS req - rejected - msext disabled\n");
|
LogPrintf(LogIPCP, "MS NS req - rejected - msext disabled\n");
|
||||||
IpcpInfo.my_reject |= ( 1 << type );
|
IpcpInfo.my_reject |= ( 1 << type );
|
||||||
bcopy(cp, rejp, length);
|
bcopy(cp, rejp, length);
|
||||||
rejp += length;
|
rejp += length;
|
||||||
@ -499,7 +501,7 @@ int mode;
|
|||||||
so well tell 'em how it is
|
so well tell 'em how it is
|
||||||
*/
|
*/
|
||||||
bcopy( cp, nakp, 2 ); /* copy first two (type/length) */
|
bcopy( cp, nakp, 2 ); /* copy first two (type/length) */
|
||||||
LogPrintf( LogLCP, "MS NS req %d:%s->%s - nak\n",
|
LogPrintf( LogIPCP, "MS NS req %d:%s->%s - nak\n",
|
||||||
type,
|
type,
|
||||||
inet_ntoa( dnsstuff ),
|
inet_ntoa( dnsstuff ),
|
||||||
inet_ntoa( ms_info_req ));
|
inet_ntoa( ms_info_req ));
|
||||||
@ -511,17 +513,17 @@ int mode;
|
|||||||
Otherwise they have it right (this time) so we send
|
Otherwise they have it right (this time) so we send
|
||||||
a ack packet back confirming it... end of story
|
a ack packet back confirming it... end of story
|
||||||
*/
|
*/
|
||||||
LogPrintf( LogLCP, "MS NS req %d:%s ok - ack\n",
|
LogPrintf( LogIPCP, "MS NS req %d:%s ok - ack\n",
|
||||||
type,
|
type,
|
||||||
inet_ntoa( ms_info_req ));
|
inet_ntoa( ms_info_req ));
|
||||||
bcopy( cp, ackp, length );
|
bcopy( cp, ackp, length );
|
||||||
ackp += length;
|
ackp += length;
|
||||||
break;
|
break;
|
||||||
case MODE_NAK: /* what does this mean?? */
|
case MODE_NAK: /* what does this mean?? */
|
||||||
LogPrintf(LogLCP, "MS NS req %d - NAK??\n", type );
|
LogPrintf(LogIPCP, "MS NS req %d - NAK??\n", type );
|
||||||
break;
|
break;
|
||||||
case MODE_REJ: /* confused?? me to :) */
|
case MODE_REJ: /* confused?? me to :) */
|
||||||
LogPrintf(LogLCP, "MS NS req %d - REJ??\n", type );
|
LogPrintf(LogIPCP, "MS NS req %d - REJ??\n", type );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -529,7 +531,7 @@ int mode;
|
|||||||
case TY_PRIMARY_NBNS: /* MS PPP NetBIOS nameserver hack */
|
case TY_PRIMARY_NBNS: /* MS PPP NetBIOS nameserver hack */
|
||||||
case TY_SECONDARY_NBNS:
|
case TY_SECONDARY_NBNS:
|
||||||
if( !Enabled( ConfMSExt ) ) {
|
if( !Enabled( ConfMSExt ) ) {
|
||||||
LogPrintf( LogLCP, "MS NBNS req - rejected - msext disabled\n" );
|
LogPrintf( LogIPCP, "MS NBNS req - rejected - msext disabled\n" );
|
||||||
IpcpInfo.my_reject |= ( 1 << type );
|
IpcpInfo.my_reject |= ( 1 << type );
|
||||||
bcopy( cp, rejp, length );
|
bcopy( cp, rejp, length );
|
||||||
rejp += length;
|
rejp += length;
|
||||||
@ -544,24 +546,24 @@ int mode;
|
|||||||
{
|
{
|
||||||
bcopy( cp, nakp, 2 );
|
bcopy( cp, nakp, 2 );
|
||||||
bcopy( &ms_info_req.s_addr , nakp+2, length );
|
bcopy( &ms_info_req.s_addr , nakp+2, length );
|
||||||
LogPrintf( LogLCP, "MS NBNS req %d:%s->%s - nak\n",
|
LogPrintf(LogIPCP, "MS NBNS req %d:%s->%s - nak\n",
|
||||||
type,
|
type,
|
||||||
inet_ntoa( dnsstuff ),
|
inet_ntoa( dnsstuff ),
|
||||||
inet_ntoa( ms_info_req ));
|
inet_ntoa( ms_info_req ));
|
||||||
nakp += length;
|
nakp += length;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LogPrintf( LogLCP, "MS NBNS req %d:%s ok - ack\n",
|
LogPrintf(LogIPCP, "MS NBNS req %d:%s ok - ack\n",
|
||||||
type,
|
type,
|
||||||
inet_ntoa( ms_info_req ));
|
inet_ntoa( ms_info_req ));
|
||||||
bcopy( cp, ackp, length );
|
bcopy( cp, ackp, length );
|
||||||
ackp += length;
|
ackp += length;
|
||||||
break;
|
break;
|
||||||
case MODE_NAK:
|
case MODE_NAK:
|
||||||
LogPrintf( LogLCP, "MS NBNS req %d - NAK??\n", type );
|
LogPrintf(LogIPCP, "MS NBNS req %d - NAK??\n", type );
|
||||||
break;
|
break;
|
||||||
case MODE_REJ:
|
case MODE_REJ:
|
||||||
LogPrintf( LogLCP, "MS NBNS req %d - REJ??\n", type );
|
LogPrintf(LogIPCP, "MS NBNS req %d - REJ??\n", type );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: lcp.c,v 1.24 1997/06/14 00:21:23 ache Exp $
|
* $Id: lcp.c,v 1.25 1997/08/01 02:02:28 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* o Validate magic number received from peer.
|
* o Validate magic number received from peer.
|
||||||
@ -76,9 +76,10 @@ struct fsm LcpFsm = {
|
|||||||
OPEN_ACTIVE,
|
OPEN_ACTIVE,
|
||||||
ST_INITIAL, /* State of machine */
|
ST_INITIAL, /* State of machine */
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
|
|
||||||
0,
|
0,
|
||||||
{ 0, 0, 0, NULL, NULL, NULL },
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
{ 0, 0, 0, NULL, NULL, NULL },
|
||||||
|
LogLCP,
|
||||||
|
|
||||||
LcpLayerUp,
|
LcpLayerUp,
|
||||||
LcpLayerDown,
|
LcpLayerDown,
|
||||||
|
@ -13,11 +13,13 @@
|
|||||||
static char *LogNames[] = {
|
static char *LogNames[] = {
|
||||||
"Async",
|
"Async",
|
||||||
"Carrier",
|
"Carrier",
|
||||||
|
"CCP",
|
||||||
"Chat",
|
"Chat",
|
||||||
"Command",
|
"Command",
|
||||||
"Connect",
|
"Connect",
|
||||||
"Debug",
|
"Debug",
|
||||||
"HDLC",
|
"HDLC",
|
||||||
|
"IPCP",
|
||||||
"LCP",
|
"LCP",
|
||||||
"Link",
|
"Link",
|
||||||
"LQM",
|
"LQM",
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
#define LogMIN (1)
|
#define LogMIN (1)
|
||||||
#define LogASYNC (1) /* syslog(LOG_INFO, ....) */
|
#define LogASYNC (1) /* syslog(LOG_INFO, ....) */
|
||||||
#define LogCARRIER (2)
|
#define LogCARRIER (2)
|
||||||
#define LogCHAT (3)
|
#define LogCCP (3)
|
||||||
#define LogCOMMAND (4)
|
#define LogCHAT (4)
|
||||||
#define LogCONNECT (5)
|
#define LogCOMMAND (5)
|
||||||
#define LogDEBUG (6) /* syslog(LOG_DEBUG, ....) */
|
#define LogCONNECT (6)
|
||||||
#define LogHDLC (7)
|
#define LogDEBUG (7) /* syslog(LOG_DEBUG, ....) */
|
||||||
#define LogLCP (8)
|
#define LogHDLC (8)
|
||||||
#define LogLINK (9)
|
#define LogIPCP (9)
|
||||||
#define LogLQM (10)
|
#define LogLCP (10)
|
||||||
#define LogPHASE (11)
|
#define LogLINK (11)
|
||||||
#define LogTCPIP (12)
|
#define LogLQM (12)
|
||||||
#define LogTUN (13) /* If set, tun%d is output with each message */
|
#define LogPHASE (13)
|
||||||
#define LogMAXCONF (13)
|
#define LogTCPIP (14)
|
||||||
#define LogWARN (14) /* Sent to VarTerm else syslog(LOG_WARNING, ) */
|
#define LogTUN (15) /* If set, tun%d is output with each message */
|
||||||
#define LogERROR (15) /* syslog(LOG_ERR, ....), + sent to VarTerm */
|
#define LogMAXCONF (15)
|
||||||
#define LogALERT (16) /* syslog(LOG_ALERT, ....) */
|
#define LogWARN (16) /* Sent to VarTerm else syslog(LOG_WARNING, ) */
|
||||||
#define LogMAX (16)
|
#define LogERROR (17) /* syslog(LOG_ERR, ....), + sent to VarTerm */
|
||||||
|
#define LogALERT (18) /* syslog(LOG_ALERT, ....) */
|
||||||
|
#define LogMAX (18)
|
||||||
|
|
||||||
/* The first int arg for all of the following is one of the above values */
|
/* The first int arg for all of the following is one of the above values */
|
||||||
extern const char *LogName(int);
|
extern const char *LogName(int);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: ppp.8,v 1.52 1997/08/19 11:18:34 danny Exp $
|
.\" $Id: ppp.8,v 1.53 1997/08/19 11:27:00 danny Exp $
|
||||||
.Dd 20 September 1995
|
.Dd 20 September 1995
|
||||||
.Os FreeBSD
|
.Os FreeBSD
|
||||||
.Dt PPP 8
|
.Dt PPP 8
|
||||||
@ -758,7 +758,7 @@ ui-gate:
|
|||||||
set device ui-gate:ppp-in
|
set device ui-gate:ppp-in
|
||||||
set dial
|
set dial
|
||||||
set timeout 30 5 4
|
set timeout 30 5 4
|
||||||
set log Phase Chat Connect Carrier hdlc LCP tun
|
set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
|
||||||
set ifaddr 10.0.4.2 10.0.4.1
|
set ifaddr 10.0.4.2 10.0.4.1
|
||||||
add 10.0.4.2 255.255.255.255 127.0.0.1
|
add 10.0.4.2 255.255.255.255 127.0.0.1
|
||||||
add 10.0.2.0 255.255.255.0 10.0.4.2
|
add 10.0.2.0 255.255.255.0 10.0.4.2
|
||||||
@ -1214,7 +1214,7 @@ add 0 0 HISADDR
|
|||||||
.Ed
|
.Ed
|
||||||
|
|
||||||
HISADDR is a macro meaning the "other side"s IP number, and is
|
HISADDR is a macro meaning the "other side"s IP number, and is
|
||||||
available once an IP number has been agreed (using LCP).
|
available once an IP number has been agreed (using IPCP).
|
||||||
Now, once a connection is established,
|
Now, once a connection is established,
|
||||||
.Nm
|
.Nm
|
||||||
will delete all non-direct interface routes, and add a default route
|
will delete all non-direct interface routes, and add a default route
|
||||||
@ -1260,12 +1260,14 @@ is able to generate the following log info via
|
|||||||
.Bl -column SMMMMMM -offset indent
|
.Bl -column SMMMMMM -offset indent
|
||||||
.It Li Async Dump async level packet in hex
|
.It Li Async Dump async level packet in hex
|
||||||
.It Li Carrier Log Chat lines with 'CARRIER'
|
.It Li Carrier Log Chat lines with 'CARRIER'
|
||||||
|
.It Li CCP Generate a CPP packet trace
|
||||||
.It Li Chat Generate Chat script trace log
|
.It Li Chat Generate Chat script trace log
|
||||||
.It Li Command Log commands executed
|
.It Li Command Log commands executed
|
||||||
.It Li Connect Generate complete Chat log
|
.It Li Connect Generate complete Chat log
|
||||||
.It Li Debug Log (very verbose) debug information
|
.It Li Debug Log (very verbose) debug information
|
||||||
.It Li HDLC Dump HDLC packet in hex
|
.It Li HDLC Dump HDLC packet in hex
|
||||||
.It Li LCP Generate LCP/IPCP packet trace
|
.It Li IPCP Generate an IPCP packet trace
|
||||||
|
.It Li LCP Generate an LCP packet trace
|
||||||
.It Li Link Log address assignments and link up/down events
|
.It Li Link Log address assignments and link up/down events
|
||||||
.It Li LQM Generate LQR report
|
.It Li LQM Generate LQR report
|
||||||
.It Li Phase Phase transition log output
|
.It Li Phase Phase transition log output
|
||||||
@ -1666,8 +1668,8 @@ receive the increased packet size.
|
|||||||
.It set openmode active|passive
|
.It set openmode active|passive
|
||||||
By default, openmode is always active. That is,
|
By default, openmode is always active. That is,
|
||||||
.Nm
|
.Nm
|
||||||
will always initiate LCP negotiation. If you want to wait for the
|
will always initiate LCP/IPCP/CCP negotiation. If you want to wait for the
|
||||||
peer to initiate LCP negotiation, you may use the value
|
peer to initiate negotiations, you may use the value
|
||||||
.Dq passive .
|
.Dq passive .
|
||||||
|
|
||||||
.It set parity odd|even|none|mark
|
.It set parity odd|even|none|mark
|
||||||
@ -1717,17 +1719,18 @@ is taken before starting at the first number again. A value of
|
|||||||
.Dq random
|
.Dq random
|
||||||
may be used here too.
|
may be used here too.
|
||||||
|
|
||||||
.It set stopped seconds
|
.It set stopped [LCPseconds [IPCPseconds [CCPseconds]]]
|
||||||
If this option is set,
|
If this option is set,
|
||||||
.Nm
|
.Nm
|
||||||
will time out after being in the stopped state for the given number of
|
will time out after the given FSM (Finite State Machine) has been in
|
||||||
|
the stopped state for the given number of
|
||||||
.Dq seconds .
|
.Dq seconds .
|
||||||
This option may be useful if you see ppp failing to respond in the
|
This option may be useful if you see ppp failing to respond in the
|
||||||
stopped state. Use
|
stopped state. Use
|
||||||
.Dq set log +lcp
|
.Dq set log +lcp +ipcp +ccp
|
||||||
to make
|
to make
|
||||||
.Nm
|
.Nm
|
||||||
log state transitions.
|
log all state transitions.
|
||||||
.Pp
|
.Pp
|
||||||
The default value is zero, where ppp doesn't time out in the stopped
|
The default value is zero, where ppp doesn't time out in the stopped
|
||||||
state.
|
state.
|
||||||
@ -1844,7 +1847,7 @@ Show the current reconnect values.
|
|||||||
Show the current redial values.
|
Show the current redial values.
|
||||||
|
|
||||||
.It show stopped
|
.It show stopped
|
||||||
Show the current stopped timeout.
|
Show the current stopped timeouts.
|
||||||
|
|
||||||
.It show route
|
.It show route
|
||||||
Show the current routing tables.
|
Show the current routing tables.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: ppp.8,v 1.52 1997/08/19 11:18:34 danny Exp $
|
.\" $Id: ppp.8,v 1.53 1997/08/19 11:27:00 danny Exp $
|
||||||
.Dd 20 September 1995
|
.Dd 20 September 1995
|
||||||
.Os FreeBSD
|
.Os FreeBSD
|
||||||
.Dt PPP 8
|
.Dt PPP 8
|
||||||
@ -758,7 +758,7 @@ ui-gate:
|
|||||||
set device ui-gate:ppp-in
|
set device ui-gate:ppp-in
|
||||||
set dial
|
set dial
|
||||||
set timeout 30 5 4
|
set timeout 30 5 4
|
||||||
set log Phase Chat Connect Carrier hdlc LCP tun
|
set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
|
||||||
set ifaddr 10.0.4.2 10.0.4.1
|
set ifaddr 10.0.4.2 10.0.4.1
|
||||||
add 10.0.4.2 255.255.255.255 127.0.0.1
|
add 10.0.4.2 255.255.255.255 127.0.0.1
|
||||||
add 10.0.2.0 255.255.255.0 10.0.4.2
|
add 10.0.2.0 255.255.255.0 10.0.4.2
|
||||||
@ -1214,7 +1214,7 @@ add 0 0 HISADDR
|
|||||||
.Ed
|
.Ed
|
||||||
|
|
||||||
HISADDR is a macro meaning the "other side"s IP number, and is
|
HISADDR is a macro meaning the "other side"s IP number, and is
|
||||||
available once an IP number has been agreed (using LCP).
|
available once an IP number has been agreed (using IPCP).
|
||||||
Now, once a connection is established,
|
Now, once a connection is established,
|
||||||
.Nm
|
.Nm
|
||||||
will delete all non-direct interface routes, and add a default route
|
will delete all non-direct interface routes, and add a default route
|
||||||
@ -1260,12 +1260,14 @@ is able to generate the following log info via
|
|||||||
.Bl -column SMMMMMM -offset indent
|
.Bl -column SMMMMMM -offset indent
|
||||||
.It Li Async Dump async level packet in hex
|
.It Li Async Dump async level packet in hex
|
||||||
.It Li Carrier Log Chat lines with 'CARRIER'
|
.It Li Carrier Log Chat lines with 'CARRIER'
|
||||||
|
.It Li CCP Generate a CPP packet trace
|
||||||
.It Li Chat Generate Chat script trace log
|
.It Li Chat Generate Chat script trace log
|
||||||
.It Li Command Log commands executed
|
.It Li Command Log commands executed
|
||||||
.It Li Connect Generate complete Chat log
|
.It Li Connect Generate complete Chat log
|
||||||
.It Li Debug Log (very verbose) debug information
|
.It Li Debug Log (very verbose) debug information
|
||||||
.It Li HDLC Dump HDLC packet in hex
|
.It Li HDLC Dump HDLC packet in hex
|
||||||
.It Li LCP Generate LCP/IPCP packet trace
|
.It Li IPCP Generate an IPCP packet trace
|
||||||
|
.It Li LCP Generate an LCP packet trace
|
||||||
.It Li Link Log address assignments and link up/down events
|
.It Li Link Log address assignments and link up/down events
|
||||||
.It Li LQM Generate LQR report
|
.It Li LQM Generate LQR report
|
||||||
.It Li Phase Phase transition log output
|
.It Li Phase Phase transition log output
|
||||||
@ -1666,8 +1668,8 @@ receive the increased packet size.
|
|||||||
.It set openmode active|passive
|
.It set openmode active|passive
|
||||||
By default, openmode is always active. That is,
|
By default, openmode is always active. That is,
|
||||||
.Nm
|
.Nm
|
||||||
will always initiate LCP negotiation. If you want to wait for the
|
will always initiate LCP/IPCP/CCP negotiation. If you want to wait for the
|
||||||
peer to initiate LCP negotiation, you may use the value
|
peer to initiate negotiations, you may use the value
|
||||||
.Dq passive .
|
.Dq passive .
|
||||||
|
|
||||||
.It set parity odd|even|none|mark
|
.It set parity odd|even|none|mark
|
||||||
@ -1717,17 +1719,18 @@ is taken before starting at the first number again. A value of
|
|||||||
.Dq random
|
.Dq random
|
||||||
may be used here too.
|
may be used here too.
|
||||||
|
|
||||||
.It set stopped seconds
|
.It set stopped [LCPseconds [IPCPseconds [CCPseconds]]]
|
||||||
If this option is set,
|
If this option is set,
|
||||||
.Nm
|
.Nm
|
||||||
will time out after being in the stopped state for the given number of
|
will time out after the given FSM (Finite State Machine) has been in
|
||||||
|
the stopped state for the given number of
|
||||||
.Dq seconds .
|
.Dq seconds .
|
||||||
This option may be useful if you see ppp failing to respond in the
|
This option may be useful if you see ppp failing to respond in the
|
||||||
stopped state. Use
|
stopped state. Use
|
||||||
.Dq set log +lcp
|
.Dq set log +lcp +ipcp +ccp
|
||||||
to make
|
to make
|
||||||
.Nm
|
.Nm
|
||||||
log state transitions.
|
log all state transitions.
|
||||||
.Pp
|
.Pp
|
||||||
The default value is zero, where ppp doesn't time out in the stopped
|
The default value is zero, where ppp doesn't time out in the stopped
|
||||||
state.
|
state.
|
||||||
@ -1844,7 +1847,7 @@ Show the current reconnect values.
|
|||||||
Show the current redial values.
|
Show the current redial values.
|
||||||
|
|
||||||
.It show stopped
|
.It show stopped
|
||||||
Show the current stopped timeout.
|
Show the current stopped timeouts.
|
||||||
|
|
||||||
.It show route
|
.It show route
|
||||||
Show the current routing tables.
|
Show the current routing tables.
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: vars.c,v 1.20 1997/06/09 23:38:38 brian Exp $
|
* $Id: vars.c,v 1.21 1997/08/17 20:45:49 brian Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
char VarVersion[] = "PPP Version 1.00";
|
char VarVersion[] = "PPP Version 1.00";
|
||||||
char VarLocalVersion[] = "$Date: 1997/06/09 23:38:38 $";
|
char VarLocalVersion[] = "$Date: 1997/08/17 20:45:49 $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Order of conf option is important. See vars.h.
|
* Order of conf option is important. See vars.h.
|
||||||
@ -52,7 +52,7 @@ struct confdesc pppConfs[] = {
|
|||||||
struct pppvars pppVars = {
|
struct pppvars pppVars = {
|
||||||
DEF_MRU, DEF_MTU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
|
DEF_MRU, DEF_MTU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
|
||||||
RECONNECT_TIMER, RECONNECT_TRIES, REDIAL_PERIOD,
|
RECONNECT_TIMER, RECONNECT_TRIES, REDIAL_PERIOD,
|
||||||
NEXT_REDIAL_PERIOD, 1, 0, MODEM_DEV, BASE_MODEM_DEV,
|
NEXT_REDIAL_PERIOD, 1, MODEM_DEV, BASE_MODEM_DEV,
|
||||||
OPEN_ACTIVE, LOCAL_NO_AUTH,0
|
OPEN_ACTIVE, LOCAL_NO_AUTH,0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: vars.h,v 1.21 1997/08/17 20:38:45 brian Exp $
|
* $Id: vars.h,v 1.22 1997/08/17 20:45:50 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,6 @@ struct pppvars {
|
|||||||
int redial_timeout; /* Redial timeout value */
|
int redial_timeout; /* Redial timeout value */
|
||||||
int redial_next_timeout; /* Redial next timeout value */
|
int redial_next_timeout; /* Redial next timeout value */
|
||||||
int dial_tries; /* Dial attempts before giving up, 0 == inf */
|
int dial_tries; /* Dial attempts before giving up, 0 == inf */
|
||||||
int stopped_timeout; /* Timeout in ST_STOPPED */
|
|
||||||
char modem_dev[40]; /* Name of device / host:port */
|
char modem_dev[40]; /* Name of device / host:port */
|
||||||
char *base_modem_dev; /* Pointer to base of modem_dev */
|
char *base_modem_dev; /* Pointer to base of modem_dev */
|
||||||
int open_mode; /* LCP open mode */
|
int open_mode; /* LCP open mode */
|
||||||
@ -119,7 +118,6 @@ struct pppvars {
|
|||||||
#define VarRedialTimeout pppVars.redial_timeout
|
#define VarRedialTimeout pppVars.redial_timeout
|
||||||
#define VarRedialNextTimeout pppVars.redial_next_timeout
|
#define VarRedialNextTimeout pppVars.redial_next_timeout
|
||||||
#define VarDialTries pppVars.dial_tries
|
#define VarDialTries pppVars.dial_tries
|
||||||
#define VarStoppedTimeout pppVars.stopped_timeout
|
|
||||||
#define VarTerm pppVars.termfp
|
#define VarTerm pppVars.termfp
|
||||||
|
|
||||||
#define VarAliasHandlers pppVars.handler
|
#define VarAliasHandlers pppVars.handler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user