o Remove LINK level logging.
o change the default link name to ``deflink'' rather than ``default''. o Prepend the link name to CCP and LCP FSM diagnostics. o Protect against 0 length options in CCP and IPCP REQ interpreters (already done for LCP). o Allow optional context for the `show' command. o Use MPs link when interpreting commands if the multilink mrru is configured rather than when multilink is active. This means that once we've ``set mrru xxx'', we then need to ``link deflink show ccp'' etc if we want to do link-level stuff (based on the command requiring optional or manditory context). o Use the ifconfig'd interface address in `set enddisc {ip,mac}' if it's there, otherwise the configuration file value.
This commit is contained in:
parent
ed32233ca5
commit
d47dceb8ab
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35431
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.1.2.58 1998/04/23 18:56:07 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.59 1998/04/23 21:50:00 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -529,7 +529,7 @@ bundle_Create(const char *prefix, struct prompt *prompt, int type)
|
||||
bundle.cfg.mtu = DEF_MTU;
|
||||
bundle.phys_type = type;
|
||||
|
||||
bundle.links = datalink_Create("default", &bundle, &bundle.fsm, type);
|
||||
bundle.links = datalink_Create("deflink", &bundle, &bundle.fsm, type);
|
||||
if (bundle.links == NULL) {
|
||||
LogPrintf(LogERROR, "Cannot create data link: %s\n", strerror(errno));
|
||||
close(bundle.tun_fd);
|
||||
|
@ -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.36 1998/04/19 03:40:54 brian Exp $
|
||||
* $Id: ccp.c,v 1.30.2.37 1998/04/24 19:15:23 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support other compression protocols
|
||||
@ -234,7 +234,7 @@ CcpSendConfigReq(struct fsm *fp)
|
||||
}
|
||||
|
||||
if (cp + (*o)->val.len > buff + sizeof buff) {
|
||||
LogPrintf(LogERROR, "CCP REQ buffer overrun !\n");
|
||||
LogPrintf(LogERROR, "%s: CCP REQ buffer overrun !\n", fp->link->name);
|
||||
break;
|
||||
}
|
||||
memcpy(cp, &(*o)->val, (*o)->val.len);
|
||||
@ -287,7 +287,7 @@ static void
|
||||
CcpLayerStart(struct fsm *fp)
|
||||
{
|
||||
/* We're about to start up ! */
|
||||
LogPrintf(LogCCP, "CcpLayerStart.\n");
|
||||
LogPrintf(LogCCP, "%s: CcpLayerStart.\n", fp->link->name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -297,7 +297,7 @@ CcpLayerFinish(struct fsm *fp)
|
||||
struct ccp *ccp = fsm2ccp(fp);
|
||||
struct ccp_opt *next;
|
||||
|
||||
LogPrintf(LogCCP, "CcpLayerFinish.\n");
|
||||
LogPrintf(LogCCP, "%s: CcpLayerFinish.\n", fp->link->name);
|
||||
if (ccp->in.state != NULL) {
|
||||
(*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state);
|
||||
ccp->in.state = NULL;
|
||||
@ -321,7 +321,7 @@ static void
|
||||
CcpLayerDown(struct fsm *fp)
|
||||
{
|
||||
/* About to come down */
|
||||
LogPrintf(LogCCP, "CcpLayerDown.\n");
|
||||
LogPrintf(LogCCP, "%s: CcpLayerDown.\n", fp->link->name);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -332,13 +332,13 @@ CcpLayerUp(struct fsm *fp)
|
||||
{
|
||||
/* We're now up */
|
||||
struct ccp *ccp = fsm2ccp(fp);
|
||||
LogPrintf(LogCCP, "CcpLayerUp.\n");
|
||||
LogPrintf(LogCCP, "%s: CcpLayerUp.\n", fp->link->name);
|
||||
if (ccp->in.state == NULL && ccp->in.algorithm >= 0 &&
|
||||
ccp->in.algorithm < NALGORITHMS) {
|
||||
ccp->in.state = (*algorithm[ccp->in.algorithm]->i.Init)(&ccp->in.opt);
|
||||
if (ccp->in.state == NULL) {
|
||||
LogPrintf(LogERROR, "%s (in) initialisation failure\n",
|
||||
protoname(ccp->his_proto));
|
||||
LogPrintf(LogERROR, "%s: %s (in) initialisation failure\n",
|
||||
fp->link->name, protoname(ccp->his_proto));
|
||||
ccp->his_proto = ccp->my_proto = -1;
|
||||
FsmClose(fp);
|
||||
}
|
||||
@ -349,15 +349,15 @@ CcpLayerUp(struct fsm *fp)
|
||||
ccp->out.state = (*algorithm[ccp->out.algorithm]->o.Init)
|
||||
(&ccp->out.opt->val);
|
||||
if (ccp->out.state == NULL) {
|
||||
LogPrintf(LogERROR, "%s (out) initialisation failure\n",
|
||||
protoname(ccp->my_proto));
|
||||
LogPrintf(LogERROR, "%s: %s (out) initialisation failure\n",
|
||||
fp->link->name, protoname(ccp->my_proto));
|
||||
ccp->his_proto = ccp->my_proto = -1;
|
||||
FsmClose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
LogPrintf(LogCCP, "Out = %s[%d], In = %s[%d]\n",
|
||||
protoname(ccp->my_proto), ccp->my_proto,
|
||||
LogPrintf(LogCCP, "%s: Out = %s[%d], In = %s[%d]\n",
|
||||
fp->link->name, protoname(ccp->my_proto), ccp->my_proto,
|
||||
protoname(ccp->his_proto), ccp->his_proto);
|
||||
}
|
||||
|
||||
@ -375,9 +375,15 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
type = *cp;
|
||||
length = cp[1];
|
||||
|
||||
if (length == 0) {
|
||||
LogPrintf(LogCCP, "%s: CCP size zero\n", fp->link->name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (length > sizeof(struct lcp_opt)) {
|
||||
length = sizeof(struct lcp_opt);
|
||||
LogPrintf(LogCCP, "Warning: Truncating length to %d\n", length);
|
||||
LogPrintf(LogCCP, "%s: Warning: Truncating length to %d\n",
|
||||
fp->link->name, length);
|
||||
}
|
||||
|
||||
for (f = NALGORITHMS-1; f > -1; f--)
|
||||
@ -434,7 +440,8 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
if (o->val.id == cp[0])
|
||||
break;
|
||||
if (o == NULL)
|
||||
LogPrintf(LogCCP, "Warning: Ignoring peer NAK of unsent option\n");
|
||||
LogPrintf(LogCCP, "%s: Warning: Ignoring peer NAK of unsent option\n",
|
||||
fp->link->name);
|
||||
else {
|
||||
memcpy(&o->val, cp, length);
|
||||
if ((*algorithm[f]->o.Set)(&o->val) == MODE_ACK)
|
||||
@ -482,8 +489,8 @@ CcpInput(struct ccp *ccp, struct bundle *bundle, struct mbuf *bp)
|
||||
if (bundle_Phase(bundle) == PHASE_NETWORK)
|
||||
FsmInput(&ccp->fsm, bp);
|
||||
else if (bundle_Phase(bundle) < PHASE_NETWORK) {
|
||||
LogPrintf(LogCCP, "Error: Unexpected CCP in phase %s (ignored)\n",
|
||||
bundle_PhaseName(bundle));
|
||||
LogPrintf(LogCCP, "%s: Error: Unexpected CCP in phase %s (ignored)\n",
|
||||
ccp->fsm.link->name, bundle_PhaseName(bundle));
|
||||
pfree(bp);
|
||||
}
|
||||
}
|
||||
@ -496,15 +503,17 @@ CcpRecvResetAck(struct fsm *fp, u_char id)
|
||||
|
||||
if (ccp->reset_sent != -1) {
|
||||
if (id != ccp->reset_sent) {
|
||||
LogPrintf(LogWARN, "CCP: Incorrect ResetAck (id %d, not %d) ignored\n",
|
||||
id, ccp->reset_sent);
|
||||
LogPrintf(LogWARN, "CCP: %s: Incorrect ResetAck (id %d, not %d)"
|
||||
" ignored\n", fp->link->name, id, ccp->reset_sent);
|
||||
return;
|
||||
}
|
||||
/* Whaddaya know - a correct reset ack */
|
||||
} else if (id == ccp->last_reset)
|
||||
LogPrintf(LogCCP, "Duplicate ResetAck (resetting again)\n");
|
||||
LogPrintf(LogCCP, "%s: Duplicate ResetAck (resetting again)\n",
|
||||
fp->link->name);
|
||||
else {
|
||||
LogPrintf(LogWARN, "CCP: Unexpected ResetAck (id %d) ignored\n", id);
|
||||
LogPrintf(LogWARN, "CCP: %s: Unexpected ResetAck (id %d) ignored\n",
|
||||
fp->link->name, id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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.68 1998/04/23 03:22:47 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.69 1998/04/23 21:50:05 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -452,7 +452,7 @@ static struct cmdtab const Commands[] = {
|
||||
"Set parameters", "set[up] var value"},
|
||||
{"shell", "!", FgShellCommand, LOCAL_AUTH,
|
||||
"Run a subshell", "shell|! [sh command]"},
|
||||
{"show", NULL, ShowCommand, LOCAL_AUTH,
|
||||
{"show", NULL, ShowCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Show status and stats", "show var"},
|
||||
{"term", NULL, TerminalCommand, LOCAL_AUTH | LOCAL_CX,
|
||||
"Enter terminal mode", "term"},
|
||||
@ -513,7 +513,7 @@ static int
|
||||
ShowVersion(struct cmdargs const *arg)
|
||||
{
|
||||
static char VarVersion[] = "PPP Version 2.0-beta";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/23 03:22:47 $";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/23 21:50:05 $";
|
||||
|
||||
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
|
||||
return 0;
|
||||
@ -1603,7 +1603,7 @@ ChooseLink(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->cx)
|
||||
return &arg->cx->physical->link;
|
||||
else if (arg->bundle->ncp.mp.active)
|
||||
else if (arg->bundle->ncp.mp.cfg.mrru)
|
||||
return &arg->bundle->ncp.mp.link;
|
||||
else {
|
||||
struct datalink *dl = bundle2datalink(arg->bundle, NULL);
|
||||
|
@ -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.27.2.30 1998/04/19 23:08:15 brian Exp $
|
||||
* $Id: fsm.c,v 1.27.2.31 1998/04/23 21:50:07 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -112,10 +112,10 @@ StoppedTimeout(void *v)
|
||||
{
|
||||
struct fsm *fp = (struct fsm *)v;
|
||||
|
||||
LogPrintf(fp->LogLevel, "Stopped timer expired\n");
|
||||
LogPrintf(fp->LogLevel, "%s: Stopped timer expired\n", fp->link->name);
|
||||
if (fp->OpenTimer.state == TIMER_RUNNING) {
|
||||
LogPrintf(LogWARN, "%s: aborting open delay due to stopped timer\n",
|
||||
fp->name);
|
||||
LogPrintf(LogWARN, "%s: %s: aborting open delay due to stopped timer\n",
|
||||
fp->link->name, fp->name);
|
||||
StopTimer(&fp->OpenTimer);
|
||||
}
|
||||
if (fp->state == ST_STOPPED) {
|
||||
@ -155,8 +155,8 @@ fsm_Init(struct fsm *fp, const char *name, u_short proto, int mincode,
|
||||
static void
|
||||
NewState(struct fsm * fp, int new)
|
||||
{
|
||||
LogPrintf(fp->LogLevel, "State change %s --> %s\n",
|
||||
State2Nam(fp->state), State2Nam(new));
|
||||
LogPrintf(fp->LogLevel, "%s: State change %s --> %s\n",
|
||||
fp->link->name, State2Nam(fp->state), State2Nam(new));
|
||||
if (fp->state == ST_STOPPED && fp->StoppedTimer.state == TIMER_RUNNING)
|
||||
StopTimer(&fp->StoppedTimer);
|
||||
fp->state = new;
|
||||
@ -179,8 +179,8 @@ FsmOutput(struct fsm *fp, u_int code, u_int id, u_char *ptr, int count)
|
||||
struct mbuf *bp;
|
||||
|
||||
if (LogIsKept(fp->LogLevel)) {
|
||||
LogPrintf(fp->LogLevel, "Send%s(%d) state = %s\n", Code2Nam(code),
|
||||
id, State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Send%s(%d) state = %s\n",
|
||||
fp->link->name, Code2Nam(code), id, State2Nam(fp->state));
|
||||
switch (code) {
|
||||
case CODE_CONFIGREQ:
|
||||
case CODE_CONFIGACK:
|
||||
@ -232,8 +232,8 @@ FsmOpen(struct fsm * fp)
|
||||
NewState(fp, ST_STOPPED);
|
||||
} else if (fp->open_mode > 0) {
|
||||
if (fp->open_mode > 1)
|
||||
LogPrintf(LogPHASE, "Entering STOPPED state for %d seconds\n",
|
||||
fp->open_mode);
|
||||
LogPrintf(LogPHASE, "%s: Entering STOPPED state for %d seconds\n",
|
||||
fp->link->name, fp->open_mode);
|
||||
NewState(fp, ST_STOPPED);
|
||||
StopTimer(&fp->OpenTimer);
|
||||
fp->OpenTimer.load = fp->open_mode * SECTICKS;
|
||||
@ -262,6 +262,7 @@ FsmUp(struct fsm * fp)
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
NewState(fp, ST_CLOSED);
|
||||
LogPrintf(fp->LogLevel, "Using \"%s\" as a transport\n", fp->link->name);
|
||||
break;
|
||||
case ST_STARTING:
|
||||
FsmInitRestartCounter(fp);
|
||||
@ -269,7 +270,8 @@ FsmUp(struct fsm * fp)
|
||||
NewState(fp, ST_REQSENT);
|
||||
break;
|
||||
default:
|
||||
LogPrintf(fp->LogLevel, "Oops, Up at %s\n", State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Oops, Up at %s\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -431,8 +433,8 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
plen = plength(bp);
|
||||
flen = ntohs(lhp->length) - sizeof *lhp;
|
||||
if (plen < flen) {
|
||||
LogPrintf(LogERROR, "FsmRecvConfigReq: plen (%d) < flen (%d)\n",
|
||||
plen, flen);
|
||||
LogPrintf(LogERROR, "%s: FsmRecvConfigReq: plen (%d) < flen (%d)\n",
|
||||
fp->link->name, plen, flen);
|
||||
pfree(bp);
|
||||
return;
|
||||
}
|
||||
@ -443,7 +445,8 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
case ST_STARTING:
|
||||
LogPrintf(fp->LogLevel, "Oops, RCR in %s.\n", State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Oops, RCR in %s.\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
pfree(bp);
|
||||
return;
|
||||
case ST_CLOSED:
|
||||
@ -451,8 +454,8 @@ FsmRecvConfigReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
pfree(bp);
|
||||
return;
|
||||
case ST_CLOSING:
|
||||
LogPrintf(fp->LogLevel, "Error: Got ConfigReq while state = %d\n",
|
||||
fp->state);
|
||||
LogPrintf(fp->LogLevel, "%s: Error: Got ConfigReq while state = %s\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
case ST_STOPPING:
|
||||
pfree(bp);
|
||||
return;
|
||||
@ -570,7 +573,8 @@ FsmRecvConfigNak(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
case ST_STARTING:
|
||||
LogPrintf(fp->LogLevel, "Oops, RCN in %s.\n", State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Oops, RCN in %s.\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
pfree(bp);
|
||||
return;
|
||||
case ST_CLOSED:
|
||||
@ -619,7 +623,8 @@ FsmRecvTermReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
case ST_STARTING:
|
||||
LogPrintf(fp->LogLevel, "Oops, RTR in %s\n", State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Oops, RTR in %s\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
break;
|
||||
case ST_CLOSED:
|
||||
case ST_STOPPED:
|
||||
@ -693,7 +698,8 @@ FsmRecvConfigRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
switch (fp->state) {
|
||||
case ST_INITIAL:
|
||||
case ST_STARTING:
|
||||
LogPrintf(fp->LogLevel, "Oops, RCJ in %s.\n", State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Oops, RCJ in %s.\n",
|
||||
fp->link->name, State2Nam(fp->state));
|
||||
pfree(bp);
|
||||
return;
|
||||
case ST_CLOSED:
|
||||
@ -748,15 +754,16 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
|
||||
sp = (u_short *) MBUF_CTOP(bp);
|
||||
proto = ntohs(*sp);
|
||||
LogPrintf(fp->LogLevel, "-- Protocol 0x%04x (%s) was rejected.\n",
|
||||
proto, hdlc_Protocol2Nam(proto));
|
||||
LogPrintf(fp->LogLevel, "%s: -- Protocol 0x%04x (%s) was rejected!\n",
|
||||
fp->link->name, proto, hdlc_Protocol2Nam(proto));
|
||||
|
||||
switch (proto) {
|
||||
case PROTO_LQR:
|
||||
if (p)
|
||||
StopLqr(p, LQM_LQR);
|
||||
else
|
||||
LogPrintf(LogERROR, "FsmRecvProtoRej: Not a physical link !\n");
|
||||
LogPrintf(LogERROR, "%s: FsmRecvProtoRej: Not a physical link !\n",
|
||||
fp->link->name);
|
||||
break;
|
||||
case PROTO_CCP:
|
||||
if (fp->proto == PROTO_LCP) {
|
||||
@ -778,7 +785,8 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
struct lcp *lcp = fsm2lcp(fp);
|
||||
|
||||
if (lcp->want_mrru && lcp->his_mrru) {
|
||||
LogPrintf(LogPHASE, "MP protocol reject is fatal !\n");
|
||||
LogPrintf(LogPHASE, "%s: MP protocol reject is fatal !\n",
|
||||
fp->link->name);
|
||||
FsmClose(fp);
|
||||
}
|
||||
}
|
||||
@ -798,7 +806,8 @@ FsmRecvEchoReq(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
cp = MBUF_CTOP(bp);
|
||||
magic = ntohl(*(u_int32_t *)cp);
|
||||
if (magic != lcp->his_magic) {
|
||||
LogPrintf(LogERROR, "RecvEchoReq: his magic is bad!!\n");
|
||||
LogPrintf(fp->LogLevel, "%s: RecvEchoReq: Error: His magic is bad!!\n",
|
||||
fp->link->name);
|
||||
/* XXX: We should send terminate request */
|
||||
}
|
||||
if (fp->state == ST_OPENED) {
|
||||
@ -820,8 +829,8 @@ FsmRecvEchoRep(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
/* Tolerate echo replies with either magic number */
|
||||
if (magic != 0 && magic != lcp->his_magic && magic != lcp->want_magic) {
|
||||
LogPrintf(LogWARN,
|
||||
"RecvEchoRep: Bad magic: expected 0x%08x, got: 0x%08x\n",
|
||||
lcp->his_magic, magic);
|
||||
"%s: RecvEchoRep: Bad magic: expected 0x%08x, got: 0x%08x\n",
|
||||
fp->link->name, lcp->his_magic, magic);
|
||||
/*
|
||||
* XXX: We should send terminate request. But poor implementations may
|
||||
* die as a result.
|
||||
@ -901,13 +910,13 @@ FsmInput(struct fsm *fp, struct mbuf *bp)
|
||||
codep = FsmCodes + lhp->code - 1;
|
||||
if (lhp->id != fp->reqid && codep->check_reqid &&
|
||||
Enabled(fp->bundle, OPT_IDCHECK)) {
|
||||
LogPrintf(fp->LogLevel, "Recv%s(%d), dropped (expected %d)\n",
|
||||
codep->name, lhp->id, fp->reqid);
|
||||
LogPrintf(fp->LogLevel, "%s: Recv%s(%d), dropped (expected %d)\n",
|
||||
fp->link->name, codep->name, lhp->id, fp->reqid);
|
||||
return;
|
||||
}
|
||||
|
||||
LogPrintf(fp->LogLevel, "Recv%s(%d) state = %s\n",
|
||||
codep->name, lhp->id, State2Nam(fp->state));
|
||||
LogPrintf(fp->LogLevel, "%s: Recv%s(%d) state = %s\n",
|
||||
fp->link->name, codep->name, lhp->id, State2Nam(fp->state));
|
||||
|
||||
if (LogIsKept(LogDEBUG))
|
||||
LogMemory();
|
||||
@ -925,11 +934,13 @@ FsmInput(struct fsm *fp, struct mbuf *bp)
|
||||
void
|
||||
NullRecvResetReq(struct fsm *fp)
|
||||
{
|
||||
LogPrintf(fp->LogLevel, "Oops - received unexpected reset req\n");
|
||||
LogPrintf(fp->LogLevel, "%s: Oops - received unexpected reset req\n",
|
||||
fp->link->name);
|
||||
}
|
||||
|
||||
void
|
||||
NullRecvResetAck(struct fsm *fp, u_char id)
|
||||
{
|
||||
LogPrintf(fp->LogLevel, "Oops - received unexpected reset ack\n");
|
||||
LogPrintf(fp->LogLevel, "%s: Oops - received unexpected reset ack\n",
|
||||
fp->link->name);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.c,v 1.50.2.42 1998/04/23 03:22:52 brian Exp $
|
||||
* $Id: ipcp.c,v 1.50.2.43 1998/04/23 18:56:14 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o More RFC1772 backwoard compatibility
|
||||
@ -526,8 +526,7 @@ ChooseHisAddr(struct bundle *bundle, const struct in_addr gw)
|
||||
LogPrintf(LogDEBUG, "ChooseHisAddr: Check item %d (%s)\n",
|
||||
f, inet_ntoa(try));
|
||||
if (ipcp_SetIPaddress(bundle, gw, try, 1) == 0) {
|
||||
LogPrintf(LogIPCP, "ChooseHisAddr: Selected IP address %s\n",
|
||||
inet_ntoa(try));
|
||||
LogPrintf(LogIPCP, "Selected IP address %s\n", inet_ntoa(try));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -606,7 +605,7 @@ static void
|
||||
IpcpLayerStart(struct fsm * fp)
|
||||
{
|
||||
/* We're about to start up ! */
|
||||
LogPrintf(LogIPCP, "IpcpLayerStart.\n");
|
||||
LogPrintf(LogIPCP, "%s: IpcpLayerStart.\n", fp->link->name);
|
||||
|
||||
/* This is where we should be setting up the interface in DEMAND mode */
|
||||
}
|
||||
@ -615,7 +614,7 @@ static void
|
||||
IpcpLayerFinish(struct fsm *fp)
|
||||
{
|
||||
/* We're now down */
|
||||
LogPrintf(LogIPCP, "IpcpLayerFinish.\n");
|
||||
LogPrintf(LogIPCP, "%s: IpcpLayerFinish.\n", fp->link->name);
|
||||
}
|
||||
|
||||
void
|
||||
@ -665,7 +664,7 @@ IpcpLayerDown(struct fsm *fp)
|
||||
const char *s;
|
||||
|
||||
s = inet_ntoa(ipcp->peer_ifip);
|
||||
LogPrintf(LogIsKept(LogLINK) ? LogLINK : LogIPCP, "IpcpLayerDown: %s\n", s);
|
||||
LogPrintf(LogIPCP, "%s: IpcpLayerDown: %s\n", fp->link->name, s);
|
||||
|
||||
throughput_stop(&ipcp->throughput);
|
||||
throughput_log(&ipcp->throughput, LogIPCP, NULL);
|
||||
@ -692,10 +691,9 @@ IpcpLayerUp(struct fsm *fp)
|
||||
struct ipcp *ipcp = fsm2ipcp(fp);
|
||||
char tbuff[100];
|
||||
|
||||
LogPrintf(LogIPCP, "IpcpLayerUp.\n");
|
||||
LogPrintf(LogIPCP, "%s: IpcpLayerUp.\n", fp->link->name);
|
||||
snprintf(tbuff, sizeof tbuff, "myaddr = %s ", inet_ntoa(ipcp->my_ip));
|
||||
LogPrintf(LogIsKept(LogIPCP) ? LogIPCP : LogLINK, " %s hisaddr = %s\n",
|
||||
tbuff, inet_ntoa(ipcp->peer_ip));
|
||||
LogPrintf(LogIPCP, " %s hisaddr = %s\n", tbuff, inet_ntoa(ipcp->peer_ip));
|
||||
|
||||
if (ipcp->peer_compproto >> 16 == PROTO_VJCOMP)
|
||||
sl_compress_init(&ipcp->vj.cslc, (ipcp->peer_compproto >> 8) & 255);
|
||||
@ -731,12 +729,6 @@ static int
|
||||
AcceptableAddr(struct in_range *prange, struct in_addr ipaddr)
|
||||
{
|
||||
/* Is the given IP in the given range ? */
|
||||
LogPrintf(LogDEBUG, "requested = %x\n", (unsigned)htonl(ipaddr.s_addr));
|
||||
LogPrintf(LogDEBUG, "range = %x\n", (unsigned)htonl(prange->ipaddr.s_addr));
|
||||
LogPrintf(LogDEBUG, "/%x\n", (unsigned)htonl(prange->mask.s_addr));
|
||||
LogPrintf(LogDEBUG, "%x, %x\n",
|
||||
(unsigned)htonl(prange->ipaddr.s_addr & prange->mask.s_addr),
|
||||
(unsigned)htonl(ipaddr.s_addr & prange->mask.s_addr));
|
||||
return (prange->ipaddr.s_addr & prange->mask.s_addr) ==
|
||||
(ipaddr.s_addr & prange->mask.s_addr) && ipaddr.s_addr;
|
||||
}
|
||||
@ -761,6 +753,12 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
|
||||
while (plen >= sizeof(struct fsmconfig)) {
|
||||
type = *cp;
|
||||
length = cp[1];
|
||||
|
||||
if (length == 0) {
|
||||
LogPrintf(LogIPCP, "%s: IPCP size zero\n", fp->link->name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (type < NCFTYPES)
|
||||
snprintf(tbuff, sizeof tbuff, " %s[%d] ", cftypes[type], length);
|
||||
else if (type > 128 && type < 128 + NCFTYPES128)
|
||||
@ -1065,8 +1063,7 @@ UseHisaddr(struct bundle *bundle, const char *hisaddr, int setaddr)
|
||||
iplist_setrandpos(&ipcp->cfg.peer_list);
|
||||
ipcp->peer_ip = ChooseHisAddr(bundle, ipcp->my_ip);
|
||||
if (ipcp->peer_ip.s_addr == INADDR_ANY) {
|
||||
LogPrintf(LogWARN, "%s: None available !\n",
|
||||
ipcp->cfg.peer_list.src);
|
||||
LogPrintf(LogWARN, "%s: None available !\n", ipcp->cfg.peer_list.src);
|
||||
return(0);
|
||||
}
|
||||
ipcp->cfg.peer_range.ipaddr.s_addr = ipcp->peer_ip.s_addr;
|
||||
|
@ -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.55.2.44 1998/04/23 03:22:55 brian Exp $
|
||||
* $Id: lcp.c,v 1.55.2.45 1998/04/23 18:55:50 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Limit data field length by MRU
|
||||
@ -269,7 +269,8 @@ LcpSendConfigReq(struct fsm *fp)
|
||||
struct mp *mp;
|
||||
|
||||
if (!p) {
|
||||
LogPrintf(LogERROR, "LcpSendConfigReq: Not a physical link !\n");
|
||||
LogPrintf(LogERROR, "%s: LcpSendConfigReq: Not a physical link !\n",
|
||||
fp->link->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -360,7 +361,7 @@ LcpLayerStart(struct fsm *fp)
|
||||
/* We're about to start up ! */
|
||||
struct lcp *lcp = fsm2lcp(fp);
|
||||
|
||||
LogPrintf(LogLCP, "LcpLayerStart\n");
|
||||
LogPrintf(LogLCP, "%s: LcpLayerStart\n", fp->link->name);
|
||||
lcp->LcpFailedMagic = 0;
|
||||
}
|
||||
|
||||
@ -368,7 +369,7 @@ static void
|
||||
LcpLayerFinish(struct fsm *fp)
|
||||
{
|
||||
/* We're now down */
|
||||
LogPrintf(LogLCP, "LcpLayerFinish\n");
|
||||
LogPrintf(LogLCP, "%s: LcpLayerFinish\n", fp->link->name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -378,7 +379,7 @@ LcpLayerUp(struct fsm *fp)
|
||||
struct physical *p = link2physical(fp->link);
|
||||
struct lcp *lcp = fsm2lcp(fp);
|
||||
|
||||
LogPrintf(LogLCP, "LcpLayerUp\n");
|
||||
LogPrintf(LogLCP, "%s: LcpLayerUp\n", fp->link->name);
|
||||
async_SetLinkParams(&p->async, lcp);
|
||||
StartLqm(lcp);
|
||||
hdlc_StartTimer(&p->hdlc);
|
||||
@ -390,7 +391,7 @@ LcpLayerDown(struct fsm *fp)
|
||||
/* About to come down */
|
||||
struct physical *p = link2physical(fp->link);
|
||||
|
||||
LogPrintf(LogLCP, "LcpLayerDown\n");
|
||||
LogPrintf(LogLCP, "%s: LcpLayerDown\n", fp->link->name);
|
||||
hdlc_StopTimer(&p->hdlc);
|
||||
StopLqrTimer(p);
|
||||
}
|
||||
@ -412,6 +413,11 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
type = *cp;
|
||||
length = cp[1];
|
||||
|
||||
if (length == 0) {
|
||||
LogPrintf(LogLCP, "%s: LCP size zero\n", fp->link->name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (type < 0 || type >= NCFTYPES)
|
||||
snprintf(request, sizeof request, " <%d>[%d]", type, length);
|
||||
else
|
||||
@ -835,11 +841,6 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* to avoid inf. loop */
|
||||
if (length == 0) {
|
||||
LogPrintf(LogLCP, "LCP size zero\n");
|
||||
break;
|
||||
}
|
||||
plen -= length;
|
||||
cp += length;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.25.2.7 1998/04/10 13:19:10 brian Exp $
|
||||
* $Id: log.c,v 1.25.2.8 1998/04/14 23:17:08 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -64,7 +64,7 @@ static const char *LogNames[] = {
|
||||
|
||||
#define MSK(n) (1<<((n)-1))
|
||||
|
||||
static u_long LogMask = MSK(LogLINK) | MSK(LogCARRIER) | MSK(LogPHASE);
|
||||
static u_long LogMask = MSK(LogPHASE);
|
||||
static u_long LogMaskLocal = MSK(LogERROR) | MSK(LogALERT) | MSK(LogWARN);
|
||||
static int LogTunno = -1;
|
||||
static struct prompt *logprompt; /* Where to log local stuff */
|
||||
|
@ -23,31 +23,29 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.h,v 1.18.2.3 1998/04/07 00:54:01 brian Exp $
|
||||
* $Id: log.h,v 1.18.2.4 1998/04/19 23:08:35 brian Exp $
|
||||
*/
|
||||
|
||||
#define LogMIN (1)
|
||||
#define LogASYNC (1) /* syslog(LOG_INFO, ....) */
|
||||
#define LogCARRIER (2)
|
||||
#define LogCCP (3)
|
||||
#define LogCHAT (4)
|
||||
#define LogCOMMAND (5)
|
||||
#define LogCONNECT (6)
|
||||
#define LogDEBUG (7) /* syslog(LOG_DEBUG, ....) */
|
||||
#define LogHDLC (8)
|
||||
#define LogID0 (9)
|
||||
#define LogIPCP (10)
|
||||
#define LogLCP (11)
|
||||
#define LogLINK (12)
|
||||
#define LogLQM (13)
|
||||
#define LogPHASE (14)
|
||||
#define LogTCPIP (15)
|
||||
#define LogTUN (16) /* If set, tun%d is output with each message */
|
||||
#define LogMAXCONF (16)
|
||||
#define LogWARN (17) /* Sent to VarTerm else syslog(LOG_WARNING, ) */
|
||||
#define LogERROR (18) /* syslog(LOG_ERR, ....), + sent to VarTerm */
|
||||
#define LogALERT (19) /* syslog(LOG_ALERT, ....) */
|
||||
#define LogMAX (19)
|
||||
#define LogCCP (2)
|
||||
#define LogCHAT (3)
|
||||
#define LogCOMMAND (4)
|
||||
#define LogCONNECT (5)
|
||||
#define LogDEBUG (6) /* syslog(LOG_DEBUG, ....) */
|
||||
#define LogHDLC (7)
|
||||
#define LogID0 (8)
|
||||
#define LogIPCP (9)
|
||||
#define LogLCP (10)
|
||||
#define LogLQM (11)
|
||||
#define LogPHASE (12)
|
||||
#define LogTCPIP (13)
|
||||
#define LogTUN (14) /* If set, tun%d is output with each message */
|
||||
#define LogMAXCONF (14)
|
||||
#define LogWARN (15) /* Sent to VarTerm else syslog(LOG_WARNING, ) */
|
||||
#define LogERROR (16) /* syslog(LOG_ERR, ....), + sent to VarTerm */
|
||||
#define LogALERT (17) /* syslog(LOG_ALERT, ....) */
|
||||
#define LogMAX (17)
|
||||
|
||||
struct mbuf;
|
||||
struct cmdargs;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mp.c,v 1.1.2.10 1998/04/23 21:50:11 brian Exp $
|
||||
* $Id: mp.c,v 1.1.2.11 1998/04/23 23:50:39 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -640,6 +640,7 @@ int
|
||||
mp_SetEnddisc(struct cmdargs const *arg)
|
||||
{
|
||||
struct mp *mp = &arg->bundle->ncp.mp;
|
||||
struct in_addr addr;
|
||||
|
||||
if (bundle_Phase(arg->bundle) != PHASE_DEAD) {
|
||||
LogPrintf(LogWARN, "set enddisc: Only available at phase DEAD\n");
|
||||
@ -656,22 +657,28 @@ mp_SetEnddisc(struct cmdargs const *arg)
|
||||
strcpy(mp->cfg.enddisc.address, arg->bundle->cfg.label);
|
||||
mp->cfg.enddisc.len = strlen(mp->cfg.enddisc.address);
|
||||
} else if (!strcasecmp(arg->argv[arg->argn], "ip")) {
|
||||
memcpy(mp->cfg.enddisc.address,
|
||||
&arg->bundle->ncp.ipcp.cfg.my_range.ipaddr.s_addr,
|
||||
sizeof arg->bundle->ncp.ipcp.my_ip.s_addr);
|
||||
if (arg->bundle->ncp.ipcp.my_ifip.s_addr == INADDR_ANY)
|
||||
addr = arg->bundle->ncp.ipcp.my_ip;
|
||||
else
|
||||
addr = arg->bundle->ncp.ipcp.my_ifip;
|
||||
memcpy(mp->cfg.enddisc.address, &addr.s_addr, sizeof addr.s_addr);
|
||||
mp->cfg.enddisc.class = ENDDISC_IP;
|
||||
mp->cfg.enddisc.len = sizeof arg->bundle->ncp.ipcp.my_ip.s_addr;
|
||||
} else if (!strcasecmp(arg->argv[arg->argn], "mac")) {
|
||||
struct sockaddr_dl hwaddr;
|
||||
int s;
|
||||
|
||||
if (arg->bundle->ncp.ipcp.my_ifip.s_addr == INADDR_ANY)
|
||||
addr = arg->bundle->ncp.ipcp.my_ip;
|
||||
else
|
||||
addr = arg->bundle->ncp.ipcp.my_ifip;
|
||||
|
||||
s = ID0socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
LogPrintf(LogERROR, "set enddisc: socket(): %s\n", strerror(errno));
|
||||
return 2;
|
||||
}
|
||||
if (get_ether_addr(s, arg->bundle->ncp.ipcp.cfg.my_range.ipaddr,
|
||||
&hwaddr)) {
|
||||
if (get_ether_addr(s, addr, &hwaddr)) {
|
||||
mp->cfg.enddisc.class = ENDDISC_MAC;
|
||||
memcpy(mp->cfg.enddisc.address, hwaddr.sdl_data + hwaddr.sdl_nlen,
|
||||
hwaddr.sdl_alen);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.97.2.21 1998/04/23 18:56:00 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.97.2.22 1998/04/23 23:50:40 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -938,7 +938,7 @@ ui-gate:
|
||||
set device ui-gate:ppp-in
|
||||
set dial
|
||||
set timeout 30
|
||||
set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
|
||||
set log Phase Chat Connect hdlc LCP IPCP CCP tun
|
||||
set ifaddr 10.0.4.2 10.0.4.1
|
||||
add 10.0.2.0 255.255.255.0 10.0.4.1
|
||||
.Ed
|
||||
@ -1536,7 +1536,6 @@ is able to generate the following log info either via
|
||||
or directly to the screen:
|
||||
.Bl -column SMMMMMM -offset indent
|
||||
.It Li Async Dump async level packet in hex
|
||||
.It Li Carrier Log Chat lines with 'CARRIER'
|
||||
.It Li CCP Generate a CCP packet trace
|
||||
.It Li Chat Generate Chat script trace log
|
||||
.It Li Command Log commands executed
|
||||
@ -1546,7 +1545,6 @@ or directly to the screen:
|
||||
.It Li ID0 Log all function calls specifically made as user id 0.
|
||||
.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 LQM Generate LQR report
|
||||
.It Li Phase Phase transition log output
|
||||
.It Li TCP/IP Dump all TCP/IP packets
|
||||
@ -1562,7 +1560,7 @@ The
|
||||
.Dq set log
|
||||
command allows you to set the logging output level. Multiple levels
|
||||
can be specified on a single command line. The default is equivalent to
|
||||
.Dq set log Carrier Link Phase .
|
||||
.Dq set log Phase .
|
||||
.Pp
|
||||
It is also possible to log directly to the screen. The syntax is
|
||||
the same except that the word
|
||||
@ -1571,7 +1569,7 @@ should immediately follow
|
||||
.Dq set log .
|
||||
The default is
|
||||
.Dq set log local
|
||||
(ie. no direct screen logging).
|
||||
(ie. only the un-maskable warning, error and alert output).
|
||||
.Pp
|
||||
If The first argument to
|
||||
.Dq set log Op local
|
||||
@ -1580,12 +1578,12 @@ not cleared, for example:
|
||||
.Bd -literal -offset indent
|
||||
PPP ON awfulhak> set log carrier link phase
|
||||
PPP ON awfulhak> show log
|
||||
Log: Carrier Link Phase Warning Error Alert
|
||||
Log: Phase Warning Error Alert
|
||||
Local: Warning Error Alert
|
||||
PPP ON awfulhak> set log -link +tcp/ip -warning
|
||||
PPP ON awfulhak> set log +tcp/ip -warning
|
||||
PPP ON awfulhak> set log local +command
|
||||
PPP ON awfulhak> show log
|
||||
Log: Carrier Phase TCP/IP Warning Error Alert
|
||||
Log: Phase TCP/IP Warning Error Alert
|
||||
Local: Command Warning Error Alert
|
||||
.Ed
|
||||
.Pp
|
||||
|
Loading…
Reference in New Issue
Block a user