1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

Here is a diff of /usr/src/usr.sbin/ppp against current. The diffs

add some logging functionality which I find very useful.
'set debug link' will record just link up/down and address assignments.
'set debug connect' will record the entire chat dialog
'set debug carrier' will record just chat lines including 'CARRIER'
(so that I can be sure I'm getting a 28.8 line).

There was a global change required to permit LogPrintf to take a bit
mask instead of a bit position value (to permit logging some events
on either of two flags, so that no change in 'set debug lcp' would
result from the code supporting 'link'.  Thus the diffs are rather
long for such a small change.  The man page is also touched.

Oh, and there was a slight syntax problem in route.c

Reviewed by:	phk
Submitted by:	Tony Kimball <alk@Think.COM>
This commit is contained in:
Poul-Henning Kamp 1996-05-11 20:48:42 +00:00
parent 2089d0009e
commit 9c749ffb8b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15738
22 changed files with 252 additions and 175 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: arp.c,v 1.3 1996/01/10 21:27:35 phk Exp $
* $Id: arp.c,v 1.4 1996/01/11 17:48:34 phk Exp $
*
*/
@ -183,7 +183,7 @@ sifproxyarp(unit, hisaddr)
* as our local address.
*/
if (!get_ether_addr(unit, hisaddr, &dls.sdl)) {
LogPrintf(LOG_PHASE, "Cannot determine ethernet address for proxy ARP\n");
LogPrintf(LOG_PHASE_BIT, "Cannot determine ethernet address for proxy ARP\n");
return 0;
}
@ -285,7 +285,7 @@ get_ether_addr(s, ipaddr, hwaddr)
if (ifr >= ifend)
return 0;
LogPrintf(LOG_PHASE, "found interface %s for proxy arp\n", ifr->ifr_name);
LogPrintf(LOG_PHASE_BIT, "found interface %s for proxy arp\n", ifr->ifr_name);
/*
* Now scan through again looking for a link-level address

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.5 1995/09/02 17:20:49 amurai Exp $
* $Id: auth.c,v 1.6 1996/01/11 17:48:36 phk Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -154,7 +154,7 @@ int len, setaddr;
n -= 2;
if (n > 0 && setaddr) {
#ifdef DEBUG
LogPrintf(LOG_LCP, "*** n = %d, %s\n", n, vector[2]);
LogPrintf(LOG_LCP_BIT, "*** n = %d, %s\n", n, vector[2]);
#endif
ParseAddr(n--, &vector[2],
&DefHisAddress.ipaddr, &DefHisAddress.mask, &DefHisAddress.width);

View File

@ -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.5 1996/01/11 17:48:37 phk Exp $
* $Id: ccp.c,v 1.6 1996/01/30 20:04:24 phk Exp $
*
* TODO:
* o Support other compression protocols
@ -119,7 +119,7 @@ struct fsm *fp;
struct ccpstate *icp = &CcpInfo;
cp = ReqBuff;
LogPrintf(LOG_LCP, "%s: SendConfigReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendConfigReq\n", fp->name);
if (icp->want_proto && !REJECTED(icp, TY_PRED1)) {
*cp++ = TY_PRED1; *cp++ = 2;
}
@ -131,7 +131,7 @@ CcpSendResetReq(fp)
struct fsm *fp;
{
Pred1Init(1); /* Initialize Input part */
LogPrintf(LOG_LCP, "%s: SendResetReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendResetReq\n", fp->name);
FsmOutput(fp, CODE_RESETREQ, fp->reqid, NULL, 0);
}
@ -146,7 +146,7 @@ static void
CcpSendTerminateAck(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, " %s: SendTerminateAck\n", fp->name);
LogPrintf(LOG_LCP_BIT, " %s: SendTerminateAck\n", fp->name);
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
}
@ -161,21 +161,21 @@ static void
CcpLayerStart(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerStart.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerStart.\n", fp->name);
}
static void
CcpLayerFinish(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerFinish.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerFinish.\n", fp->name);
}
static void
CcpLayerDown(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerDown.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerDown.\n", fp->name);
}
/*
@ -188,8 +188,8 @@ struct fsm *fp;
#ifdef VERBOSE
fprintf(stderr, "%s: LayerUp(%d).\r\n", fp->name, fp->state);
#endif
LogPrintf(LOG_LCP, "%s: LayerUp.\n", fp->name);
LogPrintf(LOG_LCP, "myproto = %d, hisproto = %d\n",
LogPrintf(LOG_LCP_BIT, "%s: LayerUp.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "myproto = %d, hisproto = %d\n",
CcpInfo.want_proto, CcpInfo.his_proto);
Pred1Init(3); /* Initialize Input and Output */
}
@ -198,7 +198,7 @@ void
CcpUp()
{
FsmUp(&CcpFsm);
LogPrintf(LOG_LCP, "CCP Up event!!\n");
LogPrintf(LOG_LCP_BIT, "CCP Up event!!\n");
}
void
@ -231,7 +231,7 @@ int mode;
else
sprintf(tbuff, " ");
LogPrintf(LOG_LCP, "%s\n", tbuff);
LogPrintf(LOG_LCP_BIT, "%s\n", tbuff);
switch (type) {
case TY_PRED1:

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: chap.c,v 1.4 1996/01/10 21:27:37 phk Exp $
* $Id: chap.c,v 1.5 1996/01/30 11:08:25 dfr Exp $
*
* TODO:
*/
@ -63,7 +63,7 @@ int count;
#ifdef DEBUG
DumpBp(bp);
#endif
LogPrintf(LOG_LCP, "ChapOutput: %s\n", chapcodes[code]);
LogPrintf(LOG_LCP_BIT, "ChapOutput: %s\n", chapcodes[code]);
HdlcOutput(PRI_LINK, PROTO_CHAP, bp);
}
@ -130,7 +130,7 @@ struct mbuf *bp;
name = cp + valsize;
namelen = arglen - valsize - 1;
name[namelen] = 0;
LogPrintf(LOG_PHASE, " Valsize = %d, Name = %s\n", valsize, name);
LogPrintf(LOG_PHASE_BIT, " Valsize = %d, Name = %s\n", valsize, name);
/*
* Get a secret key corresponds to the peer
@ -243,7 +243,7 @@ ChapInput(struct mbuf *bp)
if (len >= ntohs(chp->length)) {
if (chp->code < 1 || chp->code > 4)
chp->code = 0;
LogPrintf(LOG_LCP, "ChapInput: %s\n", chapcodes[chp->code]);
LogPrintf(LOG_LCP_BIT, "ChapInput: %s\n", chapcodes[chp->code]);
bp->offset += sizeof(struct fsmheader);
bp->cnt -= sizeof(struct fsmheader);

View File

@ -18,7 +18,7 @@
* Columbus, OH 43221
* (614)451-1883
*
* $Id: chat.c,v 1.8 1996/03/08 13:22:21 ache Exp $
* $Id: chat.c,v 1.9 1996/04/06 02:00:17 ache Exp $
*
* TODO:
* o Support more UUCP compatible control sequences.
@ -162,7 +162,7 @@ int sendmode;
result += strlen(phone);
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
fprintf(stderr, "Phone: %s\n", phone);
LogPrintf(LOG_PHASE, "Phone: %s\n", phone);
LogPrintf(LOG_PHASE_BIT, "Phone: %s\n", phone);
break;
case 'U':
bcopy(VarAuthName, result, strlen(VarAuthName));
@ -189,6 +189,40 @@ int sendmode;
return(result);
}
#define MAXLOGBUFF 200
static char logbuff[MAXLOGBUFF];
static int loglen = 0;
static void clear_log() {
memset(logbuff,0,MAXLOGBUFF);
loglen = 0;
}
static void flush_log() {
if ((loglevel & LOG_CONNECT_BIT)
|| ((loglevel & LOG_CARRIER_BIT)
&& strstr(logbuff,"CARRIER"))) {
LogPrintf(LOG_CONNECT_BIT|LOG_CARRIER_BIT,"Chat: %s\n",logbuff);
}
clear_log();
}
static void connect_log(char *str, int single_p) {
int space = MAXLOGBUFF - loglen - 1;
while (space--) {
if (*str == '\n') {
flush_log();
} else {
logbuff[loglen++] = *str;
}
if (single_p || !*++str) break;
}
if (!space) flush_log();
}
int
WaitforString(estr)
char *estr;
@ -197,25 +231,28 @@ char *estr;
char *s, *str, ch;
char *inp;
fd_set rfds;
int i, nfds, nb;
int i, nfds, nb, msg;
char buff[200];
#ifdef SIGALRM
int omask;
omask = sigblock(sigmask(SIGALRM));
#endif
clear_log();
(void) ExpandString(estr, buff, 0);
LogPrintf(LOG_CHAT, "Wait for (%d): %s --> %s\n", TimeoutSec, estr, buff);
LogPrintf(LOG_CHAT_BIT, "Wait for (%d): %s --> %s\n", TimeoutSec, estr, buff);
str = buff;
inp = inbuff;
if (strlen(str)>=IBSIZE){
str[IBSIZE]=0;
LogPrintf(LOG_CHAT, "Truncating String to %d character: %s\n", IBSIZE, str);
LogPrintf(LOG_CHAT_BIT, "Truncating String to %d character: %s\n", IBSIZE, str);
}
nfds = modem + 1;
s = str;
msg = FALSE;
for (;;) {
FD_ZERO(&rfds);
FD_SET(modem, &rfds);
@ -241,8 +278,8 @@ char *estr;
} else if (i == 0) { /* Timeout reached! */
*inp = 0;
if (inp != inbuff)
LogPrintf(LOG_CHAT, "got: %s\n", inbuff);
LogPrintf(LOG_CHAT, "can't get (%d).\n", timeout.tv_sec);
LogPrintf(LOG_CHAT_BIT, "got: %s\n", inbuff);
LogPrintf(LOG_CHAT_BIT, "can't get (%d).\n", timeout.tv_sec);
#ifdef SIGALRM
sigsetmask(omask);
#endif
@ -257,23 +294,27 @@ char *estr;
}
nb = read(modem, &(inbuff[length]), IBSIZE);
inbuff[nb + length] = 0;
connect_log(inbuff,0);
if (strstr(inbuff, str)) {
#ifdef SIGALRM
sigsetmask(omask);
#endif
flush_log();
return(MATCH);
}
for (i = 0; i < numaborts; i++) {
if (strstr(inbuff, AbortStrings[i])) {
LogPrintf(LOG_CHAT, "Abort: %s\n", AbortStrings[i]);
LogPrintf(LOG_CHAT_BIT, "Abort: %s\n", AbortStrings[i]);
#ifdef SIGALRM
sigsetmask(omask);
#endif
flush_log();
return(ABORT);
}
}
} else {
read(modem, &ch, 1);
connect_log(&ch,1);
*inp++ = ch;
if (ch == *s) {
s++;
@ -282,6 +323,7 @@ char *estr;
sigsetmask(omask);
#endif
*inp = 0;
flush_log();
return(MATCH);
}
} else {
@ -297,11 +339,12 @@ char *estr;
s1 = AbortStrings[i];
len = strlen(s1);
if ((len <= inp - inbuff) && (strncmp(inp - len, s1, len) == 0)) {
LogPrintf(LOG_CHAT, "Abort: %s\n", s1);
LogPrintf(LOG_CHAT_BIT, "Abort: %s\n", s1);
*inp = 0;
#ifdef SIGALRM
sigsetmask(omask);
#endif
flush_log();
return(ABORT);
}
}
@ -349,9 +392,9 @@ char *command, *out;
close(fids[1]);
nb = open("/dev/tty", O_RDWR);
dup2(nb, 0);
LogPrintf(LOG_CHAT, "exec: %s\n", command);
LogPrintf(LOG_CHAT_BIT, "exec: %s\n", command);
pid = execvp(command, vector);
LogPrintf(LOG_CHAT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
LogPrintf(LOG_CHAT_BIT, "execvp failed for (%d/%d): %s\n", pid, errno, command);
exit(127);
} else {
close(fids[1]);
@ -393,9 +436,9 @@ char *str;
(void) ExpandString(str, buff+2, 1);
}
if (strstr(str, "\\P")) { /* Do not log the password itself. */
LogPrintf(LOG_CHAT, "sending: %s\n", str);
LogPrintf(LOG_CHAT_BIT, "sending: %s\n", str);
} else {
LogPrintf(LOG_CHAT, "sending: %s\n", buff+2);
LogPrintf(LOG_CHAT_BIT, "sending: %s\n", buff+2);
}
cp = buff;
if (DEV_IS_SYNC)
@ -422,7 +465,7 @@ char *str;
++timeout_next;
return(MATCH);
}
LogPrintf(LOG_CHAT, "Expecting %s\n", str);
LogPrintf(LOG_CHAT_BIT, "Expecting %s\n", str);
while (*str) {
/*
* Check whether if string contains sub-send-expect.

View File

@ -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.15 1996/03/08 09:03:04 ache Exp $
* $Id: command.c,v 1.16 1996/03/08 13:22:23 ache Exp $
*
*/
#include <sys/types.h>
@ -270,8 +270,9 @@ extern int ReportHdlcStatus();
extern int ShowMemMap();
static char *LogLevelName[] = {
LM_PHASE, LM_CHAT, LM_LQM, LM_LCP,
LM_TCPIP, LM_HDLC, LM_ASYNC,
LM_PHASE, LM_CHAT, LM_LQM, LM_LCP,
LM_TCPIP, LM_HDLC, LM_ASYNC, LM_LINK,
LM_CONNECT, LM_CARRIER,
};
static int ShowDebugLevel()

View File

@ -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.5 1996/01/11 17:48:44 phk Exp $
* $Id: fsm.c,v 1.6 1996/01/30 11:08:29 dfr Exp $
*
* TODO:
* o Refer loglevel for log output
@ -58,7 +58,7 @@ NewState(fp, new)
struct fsm *fp;
int new;
{
LogPrintf(LOG_LCP, "%s: state change %s --> %s\n",
LogPrintf(LOG_LCP_BIT, "%s: state change %s --> %s\n",
fp->name, StateNames[fp->state], StateNames[new]);
fp->state = new;
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED))
@ -137,7 +137,7 @@ struct fsm *fp;
NewState(fp, ST_REQSENT);
break;
default:
LogPrintf(LOG_LCP, "%s: Oops, Up at %s\n",
LogPrintf(LOG_LCP_BIT, "%s: Oops, Up at %s\n",
fp->name, StateNames[fp->state]);
break;
}
@ -215,7 +215,7 @@ void
FsmSendTerminateReq(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: SendTerminateReq.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendTerminateReq.\n", fp->name);
FsmOutput(fp, CODE_TERMREQ, fp->reqid++, NULL, 0);
(fp->SendTerminateReq)(fp);
StartTimer(&fp->FsmTimer); /* Start restart timer */
@ -229,7 +229,7 @@ struct fsmheader *lhp;
u_char *option;
int count;
{
LogPrintf(LOG_LCP, "%s: SendConfigAck(%s)\n", fp->name, StateNames[fp->state]);
LogPrintf(LOG_LCP_BIT, "%s: SendConfigAck(%s)\n", fp->name, StateNames[fp->state]);
(fp->DecodeConfig)(option, count, MODE_NOP);
FsmOutput(fp, CODE_CONFIGACK, lhp->id, option, count);
}
@ -241,7 +241,7 @@ struct fsmheader *lhp;
u_char *option;
int count;
{
LogPrintf(LOG_LCP, "%s: SendConfigRej(%s)\n", fp->name, StateNames[fp->state]);
LogPrintf(LOG_LCP_BIT, "%s: SendConfigRej(%s)\n", fp->name, StateNames[fp->state]);
(fp->DecodeConfig)(option, count, MODE_NOP);
FsmOutput(fp, CODE_CONFIGREJ, lhp->id, option, count);
}
@ -253,7 +253,7 @@ struct fsmheader *lhp;
u_char *option;
int count;
{
LogPrintf(LOG_LCP, "%s: SendConfigNak(%s)\n",
LogPrintf(LOG_LCP_BIT, "%s: SendConfigNak(%s)\n",
fp->name, StateNames[fp->state]);
(fp->DecodeConfig)(option, count, MODE_NOP);
FsmOutput(fp, CODE_CONFIGNAK, lhp->id, option, count);
@ -340,7 +340,7 @@ struct mbuf *bp;
switch (fp->state) {
case ST_INITIAL:
case ST_STARTING:
LogPrintf(LOG_LCP, "%s: Oops, RCR in %s.\n",
LogPrintf(LOG_LCP_BIT, "%s: Oops, RCR in %s.\n",
fp->name, StateNames[fp->state]);
pfree(bp);
return;
@ -461,7 +461,7 @@ struct mbuf *bp;
switch (fp->state) {
case ST_INITIAL:
case ST_STARTING:
LogPrintf(LOG_LCP, "%s: Oops, RCN in %s.\n",
LogPrintf(LOG_LCP_BIT, "%s: Oops, RCN in %s.\n",
fp->name, StateNames[fp->state]);
pfree(bp);
return;
@ -505,7 +505,7 @@ struct mbuf *bp;
switch (fp->state) {
case ST_INITIAL:
case ST_STARTING:
LogPrintf(LOG_LCP, "%s: Oops, RTR in %s\n", fp->name,
LogPrintf(LOG_LCP_BIT, "%s: Oops, RTR in %s\n", fp->name,
StateNames[fp->state]);
break;
case ST_CLOSED:
@ -571,7 +571,7 @@ struct mbuf *bp;
pfree(bp);
return;
}
LogPrintf(LOG_LCP, "%s: RecvConfigRej.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvConfigRej.\n", fp->name);
/*
* Check and process easy case
@ -579,7 +579,7 @@ struct mbuf *bp;
switch (fp->state) {
case ST_INITIAL:
case ST_STARTING:
LogPrintf(LOG_LCP, "%s: Oops, RCJ in %s.\n",
LogPrintf(LOG_LCP_BIT, "%s: Oops, RCJ in %s.\n",
fp->name, StateNames[fp->state]);
pfree(bp);
return;
@ -619,7 +619,7 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvCodeRej\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvCodeRej\n", fp->name);
pfree(bp);
}
@ -633,7 +633,7 @@ struct mbuf *bp;
sp = (u_short *)MBUF_CTOP(bp);
proto = ntohs(*sp);
LogPrintf(LOG_LCP, "-- Protocol (%04x) was rejected.\n", proto);
LogPrintf(LOG_LCP_BIT, "-- Protocol (%04x) was rejected.\n", proto);
switch (proto) {
case PROTO_LQR:
@ -674,7 +674,7 @@ struct mbuf *bp;
if (fp->state == ST_OPENED) {
*lp = htonl(LcpInfo.want_magic); /* Insert local magic number */
LogPrintf(LOG_LCP, "%s: SendEchoRep(%s)\n", fp->name, StateNames[fp->state]);
LogPrintf(LOG_LCP_BIT, "%s: SendEchoRep(%s)\n", fp->name, StateNames[fp->state]);
FsmOutput(fp, CODE_ECHOREP, lhp->id, cp, plength(bp));
}
pfree(bp);
@ -711,7 +711,7 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvDiscReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvDiscReq\n", fp->name);
pfree(bp);
}
@ -721,7 +721,7 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvIdent\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvIdent\n", fp->name);
pfree(bp);
}
@ -731,7 +731,7 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvTimeRemain\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvTimeRemain\n", fp->name);
pfree(bp);
}
@ -741,9 +741,9 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvResetReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvResetReq\n", fp->name);
CcpRecvResetReq(fp);
LogPrintf(LOG_LCP, "%s: SendResetAck\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendResetAck\n", fp->name);
FsmOutput(fp, CODE_RESETACK, fp->reqid, NULL, 0);
pfree(bp);
}
@ -754,7 +754,7 @@ struct fsm *fp;
struct fsmheader *lhp;
struct mbuf *bp;
{
LogPrintf(LOG_LCP, "%s: RecvResetAck\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: RecvResetAck\n", fp->name);
fp->reqid++;
pfree(bp);
}
@ -801,7 +801,7 @@ struct mbuf *bp;
bp->cnt -= sizeof(struct fsmheader);
codep = FsmCodes + lhp->code - 1;
LogPrintf(LOG_LCP, "%s: Received %s (%d) state = %s (%d)\n",
LogPrintf(LOG_LCP_BIT, "%s: Received %s (%d) state = %s (%d)\n",
fp->name, codep->name, lhp->id, StateNames[fp->state], fp->state);
#ifdef DEBUG
LogMemory();

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: hdlc.c,v 1.7 1996/01/11 17:48:46 phk Exp $
* $Id: hdlc.c,v 1.8 1996/01/30 20:04:31 phk Exp $
*
* TODO:
*/
@ -243,7 +243,7 @@ struct mbuf *bp;
Pred1Input(bp);
break;
default:
LogPrintf(LOG_PHASE, "Unknown protocol 0x%04x\n", proto);
LogPrintf(LOG_PHASE_BIT, "Unknown protocol 0x%04x\n", proto);
bp->offset -= 2;
bp->cnt += 2;
cp = MBUF_CTOP(bp);
@ -299,7 +299,7 @@ HdlcErrorCheck()
struct hdlcstat *op = &laststat;
if (bcmp(hp, op, sizeof(laststat))) {
LogPrintf(LOG_PHASE, "HDLC errors -> FCS: %u ADDR: %u COMD: %u PROTO: %u\n",
LogPrintf(LOG_PHASE_BIT, "HDLC errors -> FCS: %u ADDR: %u COMD: %u PROTO: %u\n",
hp->badfcs - op->badfcs, hp->badaddr - op->badaddr,
hp->badcommand - op->badcommand, hp->unknownproto - op->unknownproto);
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ip.c,v 1.7 1996/01/11 17:48:49 phk Exp $
* $Id: ip.c,v 1.8 1996/01/30 11:08:33 dfr Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@ -42,7 +42,7 @@ static struct pppTimer IdleTimer;
static void IdleTimeout()
{
LogPrintf(LOG_PHASE, "Idle timer expired.\n");
LogPrintf(LOG_PHASE_BIT, "Idle timer expired.\n");
LcpClose();
}

View File

@ -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.6 1995/07/08 08:28:04 amurai Exp $
* $Id: ipcp.c,v 1.7 1996/01/11 17:48:50 phk Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -199,7 +199,7 @@ struct fsm *fp;
struct ipcpstate *icp = &IpcpInfo;
cp = ReqBuff;
LogPrintf(LOG_LCP, "%s: SendConfigReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendConfigReq\n", fp->name);
if (!DEV_IS_SYNC || !REJECTED(icp, TY_IPADDR))
PutConfValue(&cp, cftypes, TY_IPADDR, 6, ntohl(icp->want_ipaddr.s_addr));
if (icp->want_compproto && !REJECTED(icp, TY_COMPPROTO)) {
@ -222,7 +222,7 @@ static void
IpcpSendTerminateAck(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, " %s: SendTerminateAck\n", fp->name);
LogPrintf(LOG_LCP_BIT, " %s: SendTerminateAck\n", fp->name);
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
}
@ -230,14 +230,14 @@ static void
IpcpLayerStart(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerStart.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerStart.\n", fp->name);
}
static void
IpcpLayerFinish(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerFinish.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerFinish.\n", fp->name);
LcpClose();
NewPhase(PHASE_TERMINATE);
}
@ -246,7 +246,7 @@ static void
IpcpLayerDown(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerDown.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerDown.\n", fp->name);
StopTimer(&IpcpReportTimer);
}
@ -263,9 +263,9 @@ struct fsm *fp;
fprintf(stderr, "%s: LayerUp(%d).\r\n", fp->name, fp->state);
#endif
Prompt(1);
LogPrintf(LOG_LCP, "%s: LayerUp.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerUp.\n", fp->name);
sprintf(tbuff, "myaddr = %s ", inet_ntoa(IpcpInfo.want_ipaddr));
LogPrintf(LOG_LCP, " %s hisaddr = %s\n", tbuff, inet_ntoa(IpcpInfo.his_ipaddr));
LogPrintf(LOG_LCP_BIT|LOG_LINK_BIT, " %s hisaddr = %s\n", tbuff, inet_ntoa(IpcpInfo.his_ipaddr));
OsSetIpaddress(IpcpInfo.want_ipaddr, IpcpInfo.his_ipaddr, ifnetmask);
OsLinkup();
IpcpStartReport();
@ -276,7 +276,7 @@ void
IpcpUp()
{
FsmUp(&IpcpFsm);
LogPrintf(LOG_LCP, "IPCP Up event!!\n");
LogPrintf(LOG_LCP_BIT, "IPCP Up event!!\n");
}
void
@ -331,7 +331,7 @@ int mode;
case TY_IPADDR: /* RFC1332 */
lp = (u_long *)(cp + 2);
ipaddr.s_addr = *lp;
LogPrintf(LOG_LCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
LogPrintf(LOG_LCP_BIT, "%s %s\n", tbuff, inet_ntoa(ipaddr));
switch (mode) {
case MODE_REQ:
@ -356,7 +356,7 @@ int mode;
* Use address suggested by peer.
*/
sprintf(tbuff+50, "%s changing address: %s ", tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
LogPrintf(LOG_LCP, "%s --> %s\n", tbuff+50, inet_ntoa(ipaddr));
LogPrintf(LOG_LCP_BIT, "%s --> %s\n", tbuff+50, inet_ntoa(ipaddr));
IpcpInfo.want_ipaddr = ipaddr;
}
break;
@ -368,7 +368,7 @@ int mode;
case TY_COMPPROTO:
lp = (u_long *)(cp + 2);
compproto = htonl(*lp);
LogPrintf(LOG_LCP, "%s %08x\n", tbuff, compproto);
LogPrintf(LOG_LCP_BIT, "%s %08x\n", tbuff, compproto);
switch (mode) {
case MODE_REQ:
@ -416,7 +416,7 @@ int mode;
}
break;
case MODE_NAK:
LogPrintf(LOG_LCP, "%s changing compproto: %08x --> %08x\n",
LogPrintf(LOG_LCP_BIT, "%s changing compproto: %08x --> %08x\n",
tbuff, IpcpInfo.want_compproto, compproto);
IpcpInfo.want_compproto = compproto;
break;
@ -430,8 +430,8 @@ int mode;
ipaddr.s_addr = *lp;
lp = (u_long *)(cp + 6);
dstipaddr.s_addr = *lp;
LogPrintf(LOG_LCP, "%s %s, ", tbuff, inet_ntoa(ipaddr));
LogPrintf(LOG_LCP, "%s\n", inet_ntoa(dstipaddr));
LogPrintf(LOG_LCP_BIT, "%s %s, ", tbuff, inet_ntoa(ipaddr));
LogPrintf(LOG_LCP_BIT, "%s\n", inet_ntoa(dstipaddr));
switch (mode) {
case MODE_REQ:
@ -441,9 +441,9 @@ int mode;
ackp += length;
break;
case MODE_NAK:
LogPrintf(LOG_LCP, "%s changing address: %s ",
LogPrintf(LOG_LCP_BIT, "%s changing address: %s ",
tbuff, inet_ntoa(IpcpInfo.want_ipaddr));
LogPrintf(LOG_LCP, "--> %s\n", inet_ntoa(ipaddr));
LogPrintf(LOG_LCP_BIT, "--> %s\n", inet_ntoa(ipaddr));
IpcpInfo.want_ipaddr = ipaddr;
IpcpInfo.his_ipaddr = dstipaddr;
break;

View File

@ -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.7 1996/01/11 17:48:51 phk Exp $
* $Id: lcp.c,v 1.8 1996/01/30 11:08:35 dfr Exp $
*
* TODO:
* o Validate magic number received from peer.
@ -104,13 +104,13 @@ int new;
struct lcpstate *lcp = &LcpInfo;
phase = new;
LogPrintf(LOG_PHASE, "Phase: %s\n", PhaseNames[phase]);
LogPrintf(LOG_PHASE_BIT, "Phase: %s\n", PhaseNames[phase]);
switch (phase) {
case PHASE_AUTHENTICATE:
lcp->auth_ineed = lcp->want_auth;
lcp->auth_iwait = lcp->his_auth;
LogPrintf(LOG_PHASE, " his = %x, mine = %x\n", lcp->his_auth, lcp->want_auth);
if (lcp->his_auth || lcp->want_auth) {
LogPrintf(LOG_PHASE_BIT, " his = %x, mine = %x\n", lcp->his_auth, lcp->want_auth);
if (lcp->his_auth == PROTO_PAP)
StartAuthChallenge(&AuthPapInfo);
if (lcp->want_auth == PROTO_CHAP)
@ -229,15 +229,15 @@ u_long val;
if (len == 6) {
if (type == TY_IPADDR) {
ina.s_addr = htonl(val);
LogPrintf(LOG_LCP, " %s [%d] %s\n",
LogPrintf(LOG_LCP_BIT, " %s [%d] %s\n",
types[type], len, inet_ntoa(ina));
} else {
LogPrintf(LOG_LCP, " %s [%d] %08x\n", types[type], len, val);
LogPrintf(LOG_LCP_BIT, " %s [%d] %08x\n", types[type], len, val);
}
*cp++ = (val >> 24) & 0377;
*cp++ = (val >> 16) & 0377;
} else
LogPrintf(LOG_LCP, " %s [%d] %d\n", types[type], len, val);
LogPrintf(LOG_LCP_BIT, " %s [%d] %d\n", types[type], len, val);
*cp++ = (val >> 8) & 0377;
*cp++ = val & 0377;
*cpp = cp;
@ -251,16 +251,16 @@ struct fsm *fp;
struct lcpstate *lcp = &LcpInfo;
struct lqrreq *req;
LogPrintf(LOG_LCP, "%s: SendConfigReq\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendConfigReq\n", fp->name);
cp = ReqBuff;
if (!DEV_IS_SYNC) {
if (lcp->want_acfcomp && !REJECTED(lcp, TY_ACFCOMP)) {
*cp++ = TY_ACFCOMP; *cp++ = 2;
LogPrintf(LOG_LCP, " %s\n", cftypes[TY_ACFCOMP]);
LogPrintf(LOG_LCP_BIT, " %s\n", cftypes[TY_ACFCOMP]);
}
if (lcp->want_protocomp && !REJECTED(lcp, TY_PROTOCOMP)) {
*cp++ = TY_PROTOCOMP; *cp++ = 2;
LogPrintf(LOG_LCP, " %s\n", cftypes[TY_PROTOCOMP]);
LogPrintf(LOG_LCP_BIT, " %s\n", cftypes[TY_PROTOCOMP]);
}
if (!REJECTED(lcp, TY_ACCMAP))
PutConfValue(&cp, cftypes, TY_ACCMAP, 6, lcp->want_accmap);
@ -275,7 +275,7 @@ struct fsm *fp;
req->proto = htons(PROTO_LQR);
req->period = htonl(lcp->want_lqrperiod);
cp += sizeof(struct lqrreq);
LogPrintf(LOG_LCP, " %s (%d)\n", cftypes[TY_QUALPROTO], lcp->want_lqrperiod);
LogPrintf(LOG_LCP_BIT, " %s (%d)\n", cftypes[TY_QUALPROTO], lcp->want_lqrperiod);
}
switch (lcp->want_auth) {
case PROTO_PAP:
@ -296,7 +296,7 @@ int count;
{
struct fsm *fp = &LcpFsm;
LogPrintf(LOG_LCP, "%s: SendProtoRej\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendProtoRej\n", fp->name);
FsmOutput(fp, CODE_PROTOREJ, fp->reqid, option, count);
}
@ -311,7 +311,7 @@ static void
LcpSendTerminateAck(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: SendTerminateAck.\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: SendTerminateAck.\n", fp->name);
FsmOutput(fp, CODE_TERMACK, fp->reqid++, NULL, 0);
}
@ -319,7 +319,7 @@ static void
LcpLayerStart(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerStart\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerStart\n", fp->name);
NewPhase(PHASE_ESTABLISH);
}
@ -342,7 +342,7 @@ struct fsm *fp;
fprintf(stderr, "%s: LayerFinish\r\n", fp->name);
#endif
Prompt(1);
LogPrintf(LOG_LCP, "%s: LayerFinish\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerFinish\n", fp->name);
#ifdef notdef
OsCloseLink(0);
#else
@ -357,7 +357,7 @@ static void
LcpLayerUp(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerUp\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerUp\n", fp->name);
OsSetInterfaceParams(23, LcpInfo.his_mru, ModemSpeed());
SetLinkParams(&LcpInfo);
@ -375,7 +375,7 @@ static void
LcpLayerDown(fp)
struct fsm *fp;
{
LogPrintf(LOG_LCP, "%s: LayerDown\n", fp->name);
LogPrintf(LOG_LCP_BIT, "%s: LayerDown\n", fp->name);
StopAllTimers();
OsLinkdown();
NewPhase(PHASE_TERMINATE);
@ -440,7 +440,7 @@ int mode;
case TY_MRU:
sp = (u_short *)(cp + 2);
mru = htons(*sp);
LogPrintf(LOG_LCP, " %s %d\n", request, mru);
LogPrintf(LOG_LCP_BIT, " %s %d\n", request, mru);
switch (mode) {
case MODE_REQ:
@ -467,7 +467,7 @@ int mode;
case TY_ACCMAP:
lp = (u_long *)(cp + 2);
accmap = htonl(*lp);
LogPrintf(LOG_LCP, " %s %08x\n", request, accmap);
LogPrintf(LOG_LCP_BIT, " %s %08x\n", request, accmap);
switch (mode) {
case MODE_REQ:
@ -485,14 +485,14 @@ int mode;
case TY_AUTHPROTO:
sp = (u_short *)(cp + 2);
proto = ntohs(*sp);
LogPrintf(LOG_LCP, " %s proto = %04x\n", request, proto);
LogPrintf(LOG_LCP_BIT, " %s proto = %04x\n", request, proto);
switch (mode) {
case MODE_REQ:
switch (proto) {
case PROTO_PAP:
if (length != 4) {
LogPrintf(LOG_LCP, " %s bad length (%d)\n", request, length);
LogPrintf(LOG_LCP_BIT, " %s bad length (%d)\n", request, length);
goto reqreject;
}
if (Acceptable(ConfPap)) {
@ -508,7 +508,7 @@ int mode;
break;
case PROTO_CHAP:
if (length < 5) {
LogPrintf(LOG_LCP, " %s bad length (%d)\n", request, length);
LogPrintf(LOG_LCP_BIT, " %s bad length (%d)\n", request, length);
goto reqreject;
}
if (Acceptable(ConfChap) && cp[4] == 5) {
@ -522,7 +522,7 @@ int mode;
goto reqreject;
break;
default:
LogPrintf(LOG_LCP, " %s not implemented, NAK.\n", request);
LogPrintf(LOG_LCP_BIT, " %s not implemented, NAK.\n", request);
bcopy(cp, nakp, length);
nakp += length;
break;
@ -537,7 +537,7 @@ int mode;
break;
case TY_QUALPROTO:
req = (struct lqrreq *)cp;
LogPrintf(LOG_LCP, " %s proto: %x, interval: %dms\n",
LogPrintf(LOG_LCP_BIT, " %s proto: %x, interval: %dms\n",
request, ntohs(req->proto), ntohl(req->period)*10);
switch (mode) {
case MODE_REQ:
@ -561,7 +561,7 @@ int mode;
case TY_MAGICNUM:
lp = (u_long *)(cp + 2);
magic = ntohl(*lp);
LogPrintf(LOG_LCP, " %s %08x\n", request, magic);
LogPrintf(LOG_LCP_BIT, " %s %08x\n", request, magic);
switch (mode) {
case MODE_REQ:
@ -578,18 +578,18 @@ int mode;
}
break;
case MODE_NAK:
LogPrintf(LOG_LCP, " %s magic %08x has NAKed\n", request, magic);
LogPrintf(LOG_LCP_BIT, " %s magic %08x has NAKed\n", request, magic);
LcpInfo.want_magic = GenerateMagic();
break;
case MODE_REJ:
LogPrintf(LOG_LCP, " %s magic has REJected\n", request);
LogPrintf(LOG_LCP_BIT, " %s magic has REJected\n", request);
LcpInfo.want_magic = 0;
LcpInfo.his_reject |= (1 << type);
break;
}
break;
case TY_PROTOCOMP:
LogPrintf(LOG_LCP, " %s\n", request);
LogPrintf(LOG_LCP_BIT, " %s\n", request);
switch (mode) {
case MODE_REQ:
@ -616,7 +616,7 @@ int mode;
}
break;
case TY_ACFCOMP:
LogPrintf(LOG_LCP, " %s\n", request);
LogPrintf(LOG_LCP_BIT, " %s\n", request);
switch (mode) {
case MODE_REQ:
if (Acceptable(ConfAcfcomp)) {
@ -645,7 +645,7 @@ int mode;
}
break;
case TY_SDP:
LogPrintf(LOG_LCP, " %s\n", request);
LogPrintf(LOG_LCP_BIT, " %s\n", request);
switch (mode) {
case MODE_REQ:
case MODE_NAK:
@ -654,7 +654,7 @@ int mode;
}
break;
default:
LogPrintf(LOG_LCP, " ???[%02x]\n", type);
LogPrintf(LOG_LCP_BIT, " ???[%02x]\n", type);
if (mode == MODE_REQ) {
reqreject:
bcopy(cp, rejp, length);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: log.c,v 1.2 1995/02/26 12:17:38 amurai Exp $
* $Id: log.c,v 1.3 1995/05/30 03:50:43 rgrimes Exp $
*
*/
#include "defs.h"
@ -48,7 +48,7 @@ static struct mbuf *lognext;
static int logcnt;
static int mypid;
int loglevel = (1 << LOG_LCP)| (1 << LOG_PHASE);
int loglevel = LOG_LINK_BIT | LOG_CARRIER_BIT | LOG_PHASE_BIT;
void
ListLog()
@ -273,7 +273,7 @@ va_dcl
int = va_arg(ap, int);
format = va_arg(ap, char *);
#endif
if (!(loglevel & (1 << level)))
if (!(loglevel & level))
return;
LogTimeStamp();
vlogprintf(format, ap);

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: log.h,v 1.4 1995/02/27 03:18:16 amurai Exp $
* $Id: log.h,v 1.5 1996/01/11 17:48:51 phk Exp $
*
* TODO:
*/
@ -27,20 +27,36 @@
* Definition of log level
*/
#define LOG_PHASE 0
#define LOG_PHASE_BIT (1 << LOG_PHASE)
# define LM_PHASE "Phase"
#define LOG_CHAT 1
#define LOG_CHAT_BIT (1 << LOG_CHAT)
# define LM_CHAT "Chat"
#define LOG_LQM 2
#define LOG_LQM_BIT (1 << LOG_LQM)
# define LM_LQM "LQM"
#define LOG_LCP 3
#define LOG_LCP_BIT (1 << LOG_LCP)
# define LM_LCP "LCP"
#define LOG_TCPIP 4
#define LOG_TCPIP_BIT (1 << LOG_TCPIP)
# define LM_TCPIP "TCP/IP"
#define LOG_HDLC 5
#define LOG_HDLC_BIT (1 << LOG_HDLC)
# define LM_HDLC "HDLC"
#define LOG_ASYNC 6
#define LOG_ASYNC_BIT (1 << LOG_ASYNC)
# define LM_ASYNC "Async"
#define MAXLOGLEVEL 7
#define LOG_LINK 7
#define LOG_LINK_BIT (1 << LOG_LINK)
# define LM_LINK "Link"
#define LOG_CONNECT 8
#define LOG_CONNECT_BIT (1 << LOG_CONNECT)
# define LM_CONNECT "Connect"
#define LOG_CARRIER 9
#define LOG_CARRIER_BIT (1 << LOG_CARRIER)
# define LM_CARRIER "Carrier"
#define MAXLOGLEVEL 10
extern int loglevel;

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lqr.c,v 1.5 1996/01/11 17:48:52 phk Exp $
* $Id: lqr.c,v 1.6 1996/01/30 11:08:37 dfr Exp $
*
* o LQR based on RFC1333
*
@ -60,7 +60,7 @@ SendEchoReq()
lqr = &lqrdata;
lqr->magic = htonl(LcpInfo.want_magic);
lqr->signature = htonl(SIGNATURE);
LogPrintf(LOG_LQM, "Send echo LQR [%d]\n", echoseq);
LogPrintf(LOG_LQM_BIT, "Send echo LQR [%d]\n", echoseq);
lqr->sequence = htonl(echoseq++);
FsmOutput(fp, CODE_ECHOREQ, fp->reqid++,
(u_char *)lqr, sizeof(struct echolqr));
@ -78,7 +78,7 @@ struct mbuf *bp;
lqr = (struct echolqr *)MBUF_CTOP(bp);
if (htonl(lqr->signature) == SIGNATURE) {
seq = ntohl(lqr->sequence);
LogPrintf(LOG_LQM, "Got echo LQR [%d]\n", ntohl(lqr->sequence));
LogPrintf(LOG_LQM_BIT, "Got echo LQR [%d]\n", ntohl(lqr->sequence));
gotseq = seq;
}
}
@ -108,7 +108,7 @@ SendLqrReport()
/*
* XXX: Should implement LQM strategy
*/
LogPrintf(LOG_PHASE, "** 1 Too many ECHO packets are lost. **\n");
LogPrintf(LOG_PHASE_BIT, "** 1 Too many ECHO packets are lost. **\n");
lqmmethod = 0; /* Prevent rcursion via LcpClose() */
LcpClose();
} else {
@ -118,7 +118,7 @@ SendLqrReport()
}
} else if (lqmmethod & LQM_ECHO) {
if (echoseq - gotseq > 5) {
LogPrintf(LOG_PHASE, "** 2 Too many ECHO packets are lost. **\n");
LogPrintf(LOG_PHASE_BIT, "** 2 Too many ECHO packets are lost. **\n");
lqmmethod = 0; /* Prevent rcursion via LcpClose() */
LcpClose();
} else
@ -193,7 +193,7 @@ StartLqm()
if (Enabled(ConfLqr))
lqmmethod |= LQM_LQR;
StopTimer(&LqrTimer);
LogPrintf(LOG_LQM, "LQM method = %d\n", lqmmethod);
LogPrintf(LOG_LQM_BIT, "LQM method = %d\n", lqmmethod);
if (lcp->his_lqrperiod || lcp->want_lqrperiod) {
/*
@ -206,10 +206,10 @@ StartLqm()
LqrTimer.func = SendLqrReport;
SendLqrReport();
StartTimer(&LqrTimer);
LogPrintf(LOG_LQM, "Will send LQR every %d.%d secs\n",
LogPrintf(LOG_LQM_BIT, "Will send LQR every %d.%d secs\n",
period/100, period % 100);
} else {
LogPrintf(LOG_LQM, "LQR is not activated.\n");
LogPrintf(LOG_LQM_BIT, "LQR is not activated.\n");
}
}
@ -223,12 +223,12 @@ void
StopLqr(method)
int method;
{
LogPrintf(LOG_LQM, "StopLqr method = %x\n", method);
LogPrintf(LOG_LQM_BIT, "StopLqr method = %x\n", method);
if (method == LQM_LQR)
LogPrintf(LOG_LQM, "Stop sending LQR, Use LCP ECHO instead.\n");
LogPrintf(LOG_LQM_BIT, "Stop sending LQR, Use LCP ECHO instead.\n");
if (method == LQM_ECHO)
LogPrintf(LOG_LQM, "Stop sending LCP ECHO.\n");
LogPrintf(LOG_LQM_BIT, "Stop sending LCP ECHO.\n");
lqmmethod &= ~method;
if (lqmmethod)
SendLqrReport();

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: main.c,v 1.17 1996/03/30 18:27:45 ache Exp $
* $Id: main.c,v 1.18 1996/04/13 15:47:34 bde Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@ -157,7 +157,7 @@ int excode;
unlink(pid_filename);
}
OsInterfaceDown(1);
LogPrintf(LOG_PHASE, "PPP Terminated.\n");
LogPrintf(LOG_PHASE_BIT, "PPP Terminated.\n");
LogClose();
if (server > 0)
close(server);
@ -170,7 +170,7 @@ static void
Hangup(signo)
int signo;
{
LogPrintf(LOG_PHASE, "Signal %d, hangup.\n", signo);
LogPrintf(LOG_PHASE_BIT, "Signal %d, hangup.\n", signo);
Cleanup(EX_HANGUP);
}
@ -178,7 +178,7 @@ static void
CloseSession(signo)
int signo;
{
LogPrintf(LOG_PHASE, "Signal %d, terminate.\n", signo);
LogPrintf(LOG_PHASE_BIT, "Signal %d, terminate.\n", signo);
LcpClose();
Cleanup(EX_TERM);
}
@ -390,7 +390,7 @@ char **argv;
close(fd);
}
}
LogPrintf(LOG_PHASE, "Listening at %d.\n", port);
LogPrintf(LOG_PHASE_BIT, "Listening at %d.\n", port);
#ifdef DOTTYINIT
if (mode & (MODE_DIRECT|MODE_DEDICATED)) { /* } */
#else
@ -414,7 +414,7 @@ char **argv;
TtyInit();
TtyCommandMode(1);
}
LogPrintf(LOG_PHASE, "PPP Started.\n");
LogPrintf(LOG_PHASE_BIT, "PPP Started.\n");
do
@ -595,7 +595,7 @@ static void
RedialTimeout()
{
StopTimer(&RedialTimer);
LogPrintf(LOG_PHASE, "Redialing timer expired.\n");
LogPrintf(LOG_PHASE_BIT, "Redialing timer expired.\n");
}
static void
@ -604,7 +604,7 @@ StartRedialTimer()
StopTimer(&RedialTimer);
if (VarRedialTimeout) {
LogPrintf(LOG_PHASE, "Enter pause for redialing.\n");
LogPrintf(LOG_PHASE_BIT, "Enter pause for redialing.\n");
RedialTimer.state = TIMER_STOPPED;
if (VarRedialTimeout > 0)
@ -637,7 +637,7 @@ DoLoop()
if (mode & MODE_DIRECT) {
modem = OpenModem(mode);
LogPrintf(LOG_PHASE, "Packet mode enabled\n");
LogPrintf(LOG_PHASE_BIT, "Packet mode enabled\n");
PacketMode();
} else if (mode & MODE_DEDICATED) {
if (!modem)
@ -668,7 +668,7 @@ DoLoop()
StartRedialTimer();
} else {
tries++;
LogPrintf(LOG_CHAT, "Dial attempt %u\n", tries);
LogPrintf(LOG_CHAT_BIT, "Dial attempt %u\n", tries);
if (DialModem()) {
sleep(1); /* little pause to allow peer starts */
ModemTimeout();

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.c,v 1.22 1996/03/28 13:38:59 ache Exp $
* $Id: modem.c,v 1.23 1996/03/29 15:24:04 ache Exp $
*
* TODO:
*/
@ -213,8 +213,8 @@ static time_t uptime;
void
DownConnection()
{
LogPrintf(LOG_PHASE, "Disconnected!\n");
LogPrintf(LOG_PHASE, "Connect time: %d secs\n", time(NULL) - uptime);
LogPrintf(LOG_PHASE_BIT, "Disconnected!\n");
LogPrintf(LOG_PHASE_BIT, "Connect time: %d secs\n", time(NULL) - uptime);
if (!TermMode) {
CloseModem();
LcpDown();
@ -243,7 +243,7 @@ ModemTimeout()
if (change & TIOCM_CD) {
if (Online) {
time(&uptime);
LogPrintf(LOG_PHASE, "*Connected!\n");
LogPrintf(LOG_PHASE_BIT, "*Connected!\n");
connect_count++;
/*
* In dedicated mode, start packet mode immediate
@ -258,7 +258,7 @@ ModemTimeout()
} else {
if (!Online) {
time(&uptime);
LogPrintf(LOG_PHASE, "Connected!\n");
LogPrintf(LOG_PHASE_BIT, "Connected!\n");
mbits = TIOCM_CD;
connect_count++;
connect_time = 0;
@ -356,7 +356,7 @@ char *host, *port;
return(-1);
}
}
LogPrintf(LOG_PHASE, "Connected to %s:%s\n", host, port);
LogPrintf(LOG_PHASE_BIT, "Connected to %s:%s\n", host, port);
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock < 0) {
@ -387,12 +387,12 @@ int mode;
if (strncmp(VarDevice, "/dev", 4) == 0) {
strcpy(uucplock, rindex(VarDevice, '/')+1);
if (uu_lock(uucplock) < 0) {
LogPrintf(LOG_PHASE, "Modem %s is in use\n", VarDevice);
LogPrintf(LOG_PHASE_BIT, "Modem %s is in use\n", VarDevice);
return(-1);
}
modem = open(VarDevice, O_RDWR|O_NONBLOCK);
if (modem < 0) {
LogPrintf(LOG_PHASE, "Open Failed %s\n", VarDevice);
LogPrintf(LOG_PHASE_BIT, "Open Failed %s\n", VarDevice);
(void) uu_unlock(uucplock);
return(modem);
}

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: os.c,v 1.3 1995/05/30 03:50:52 rgrimes Exp $
* $Id: os.c,v 1.4 1996/01/11 17:48:55 phk Exp $
*
*/
#include "fsm.h"
@ -181,7 +181,7 @@ OsLinkup()
logprintf("setuid failed\n");
peer_addr = IpcpInfo.his_ipaddr;
s = (char *)inet_ntoa(peer_addr);
LogPrintf(LOG_PHASE, "OsLinkup: %s\n", s);
LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkup: %s\n", s);
if (SelectSystem(inet_ntoa(IpcpInfo.want_ipaddr), LINKFILE) < 0) {
if (dstsystem) {
@ -201,7 +201,7 @@ OsLinkdown()
if (linkup) {
s = (char *)inet_ntoa(peer_addr);
LogPrintf(LOG_PHASE, "OsLinkdown: %s\n", s);
LogPrintf(LOG_LINK_BIT|LOG_LCP_BIT, "OsLinkdown: %s\n", s);
if (!(mode & MODE_AUTO))
DeleteIfRoutes(0);
linkup = 0;
@ -253,25 +253,35 @@ int type, mtu, speed;
/*
* Open tunnel device and returns its descriptor
*/
#define MAX_TUN 256
/* MAX_TUN is set at an arbitrarily large value *
* as the loop aborts when it reaches the first *
* 'Device not configured' (ENXIO), or the third *
* 'No such file or directory' (ENOENT) error. */
int
OpenTunnel(ptun)
int *ptun;
{
int s;
char *cp;
char *suffix = "0123456789";
char ifname[IFNAMSIZ];
char devname[12];
char devname[14]; /* sufficient room for "/dev/tun65535" */
unsigned unit, enoentcount=0;
strcpy(devname, "/dev/tun0");
for (cp = suffix; *cp; cp++) {
devname[8] = *cp;
for( unit=0; unit <= MAX_TUN ; unit++ ) {
sprintf( devname, "/dev/tun%d", unit );
tun_out = open(devname, O_RDWR);
if (tun_out >= 0)
break;
if( tun_out >= 0 )
break;
if( errno == ENXIO )
unit=MAX_TUN+1;
else if( errno == ENOENT ) {
enoentcount++;
if( enoentcount > 2 )
unit=MAX_TUN+1;
}
}
*ptun = cp - suffix;
if (*cp == '\0') {
if( unit > MAX_TUN ) {
fprintf(stderr, "No tunnel device is available.\n");
return(-1);
}
@ -317,7 +327,7 @@ int *ptun;
return(-1);
}
printf("Using interface: %s\r\n", IfDevName);
LogPrintf(LOG_PHASE, "Using interface: %s\n", IfDevName);
LogPrintf(LOG_PHASE_BIT, "Using interface: %s\n", IfDevName);
close(s);
return(0);
}

View File

@ -18,7 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: pap.c,v 1.3 1995/05/30 03:50:53 rgrimes Exp $
* $Id: pap.c,v 1.4 1996/01/30 11:08:45 dfr Exp $
*
* TODO:
*/
@ -54,7 +54,7 @@ int papid;
#ifdef DEBUG
logprintf("namelen = %d, keylen = %d\n", namelen, keylen);
#endif
LogPrintf(LOG_PHASE, "PAP: %s (%s)\n", VarAuthName, VarAuthKey);
LogPrintf(LOG_PHASE_BIT, "PAP: %s (%s)\n", VarAuthName, VarAuthKey);
lh.code = PAP_REQUEST;
lh.id = papid;
lh.length = htons(plen + sizeof(struct fsmheader));
@ -91,7 +91,7 @@ int code;
cp = MBUF_CTOP(bp) + sizeof(struct fsmheader);
*cp++ = mlen;
bcopy(message, cp, mlen);
LogPrintf(LOG_PHASE, "PapOutput: %s\n", papcodes[code]);
LogPrintf(LOG_PHASE_BIT, "PapOutput: %s\n", papcodes[code]);
HdlcOutput(PRI_LINK, PROTO_PAP, bp);
}
@ -128,7 +128,7 @@ struct mbuf *bp;
if (len >= ntohs(php->length)) {
if (php->code < PAP_REQUEST || php->code > PAP_NAK)
php->code = 0;
LogPrintf(LOG_PHASE, "PapInput: %s\n", papcodes[php->code]);
LogPrintf(LOG_PHASE_BIT, "PapInput: %s\n", papcodes[php->code]);
switch (php->code) {
case PAP_REQUEST:
@ -148,7 +148,7 @@ struct mbuf *bp;
cp = (u_char *)(php + 1);
len = *cp++;
cp[len] = 0;
LogPrintf(LOG_PHASE, "Received PAP_ACK (%s)\n", cp);
LogPrintf(LOG_PHASE_BIT, "Received PAP_ACK (%s)\n", cp);
if (lcp->auth_iwait == PROTO_PAP) {
lcp->auth_iwait = 0;
if (lcp->auth_ineed == 0)
@ -160,7 +160,7 @@ struct mbuf *bp;
cp = (u_char *)(php + 1);
len = *cp++;
cp[len] = 0;
LogPrintf(LOG_PHASE, "Received PAP_NAK (%s)\n", cp);
LogPrintf(LOG_PHASE_BIT, "Received PAP_NAK (%s)\n", cp);
LcpClose();
break;
}

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.15 1996/03/09 08:18:41 ache Exp $
.\" $Id: ppp.8,v 1.16 1996/05/02 19:18:47 mpp Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -664,8 +664,11 @@ is able to generate the following log info into
.Bl -column SMMMMMM -offset indent -compat
.It Li Phase Phase transition log output
.It Li Chat Generate Chat script trace log
.It Li Connect Generate complete Chat log
.It Li Carrier Log Chat lines with 'CARRIER'
.It Li LQM Generate LQR report
.It Li LCP Generate LCP/IPCP packet trace
.It Li Link Log address assignments and link up/down events
.It Li TCP/IP Dump TCP/IP packet
.It Li HDLC Dump HDLC packet in hex
.It Li Async Dump async level packet in hex
@ -675,7 +678,7 @@ The
.Dq set debug
command allows you to set logging output level, of which
multiple levels can be specified. The default is equivalent to
.Dq set debug phase lcp .
.Dq set debug carrier link phase .
.Sh MORE DETAILS

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.15 1996/03/09 08:18:41 ache Exp $
.\" $Id: ppp.8,v 1.16 1996/05/02 19:18:47 mpp Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -664,8 +664,11 @@ is able to generate the following log info into
.Bl -column SMMMMMM -offset indent -compat
.It Li Phase Phase transition log output
.It Li Chat Generate Chat script trace log
.It Li Connect Generate complete Chat log
.It Li Carrier Log Chat lines with 'CARRIER'
.It Li LQM Generate LQR report
.It Li LCP Generate LCP/IPCP packet trace
.It Li Link Log address assignments and link up/down events
.It Li TCP/IP Dump TCP/IP packet
.It Li HDLC Dump HDLC packet in hex
.It Li Async Dump async level packet in hex
@ -675,7 +678,7 @@ The
.Dq set debug
command allows you to set logging output level, of which
multiple levels can be specified. The default is equivalent to
.Dq set debug phase lcp .
.Dq set debug carrier link phase .
.Sh MORE DETAILS

View File

@ -5,7 +5,7 @@
/*
*
* $Id: pred.c,v 1.4 1996/01/10 21:27:59 phk Exp $
* $Id: pred.c,v 1.5 1996/01/30 11:08:48 dfr Exp $
*
* pred.c -- Test program for Dave Rand's rendition of the
* predictor algorithm
@ -179,7 +179,7 @@ struct mbuf *bp;
CcpInfo.compin += olen;
len &= 0x7fff;
if (len != len1) { /* Error is detected. Send reset request */
LogPrintf(LOG_LCP, "%s: Length Error\n", CcpFsm.name);
LogPrintf(LOG_LCP_BIT, "%s: Length Error\n", CcpFsm.name);
CcpSendResetReq(&CcpFsm);
pfree(bp);
pfree(wp);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: route.c,v 1.4 1995/07/08 06:08:52 amurai Exp $
* $Id: route.c,v 1.5 1996/01/11 17:48:56 phk Exp $
*
*/
#include <sys/types.h>
@ -109,7 +109,7 @@ struct in_addr mask;
rtmes.m_rtm.rtm_msglen = nb;
wb = write(s, &rtmes, nb);
if (wb < 0) {
LogPrintf(LOG_TCPIP, "Already set route addr dst=%x, gateway=%x\n"
LogPrintf(LOG_TCPIP_BIT, "Already set route addr dst=%x, gateway=%x\n"
,dst.s_addr, gateway.s_addr);
}
#ifdef DEBUG
@ -251,7 +251,7 @@ int all;
{
struct rt_msghdr *rtm;
struct sockaddr *sa;
struct in_addr dstnet, gateway;
struct in_addr dstnet, gateway, maddr;
int needed;
char *sp, *cp, *ep;
u_long mask;
@ -339,7 +339,8 @@ int all;
gateway.s_addr = INADDR_ANY;
mask = INADDR_ANY;
}
OsSetRoute(RTM_DELETE, dstnet, gateway, htonl(mask));
maddr.s_addr = htonl(mask);
OsSetRoute(RTM_DELETE, dstnet, gateway, maddr);
}
#ifdef DEBUG
else if (rtm->rtm_index == IfIndex) {