diff options
author | brian <brian@FreeBSD.org> | 1997-06-09 03:27:43 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-06-09 03:27:43 +0000 |
commit | 94d661ac8cb907e0a869759f76cd7134c9105e6c (patch) | |
tree | 5fa88c28cbdec0d4a0d3d118b33c1042dc49c526 /usr.sbin/ppp/hdlc.c | |
parent | 328d28c6502cfec45b8ead98e18b2d8638499efb (diff) | |
download | FreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.zip FreeBSD-src-94d661ac8cb907e0a869759f76cd7134c9105e6c.tar.gz |
Overhaul ppp:
o Use syslog
o Remove references to stdout/stderr (incl perror())
o Introduce VarTerm - the interactive terminal or zero
o Allow "set timeout" to affect current session
o Change "set debug" to "set log"
o Allow "set log [+|-]flag"
o Make MSEXT and PASSWDAUTH stuff the default
o Move all #ifdef DEBUG stuff into the code - this
shouldn't be too much overhead. It's now controlled
with "set log +debug"
o Add "set log command, debug, tun, warn, error, alert"
o Remove cdefs.h, and assume an ansi compiler.
o Improve all diagnostic output
o Don't trap SIGSEGV
o SIGHUP now terminates again (log files are controlled
by syslog)
o Call CloseModem() when changing devices
o Fix parsing of third arg of "delete"
I think this fixes the "magic is same" problems that some
people have been experiencing.
The man page is being rewritten. It'll follow soon.
Diffstat (limited to 'usr.sbin/ppp/hdlc.c')
-rw-r--r-- | usr.sbin/ppp/hdlc.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c index a7a37c8..814981c 100644 --- a/usr.sbin/ppp/hdlc.c +++ b/usr.sbin/ppp/hdlc.c @@ -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.14 1997/05/10 01:22:10 brian Exp $ + * $Id: hdlc.c,v 1.15 1997/05/26 00:43:59 brian Exp $ * * TODO: */ @@ -186,7 +186,7 @@ HdlcOutput(int pri, u_short proto, struct mbuf *bp) *cp++ = fcs >> 8; } - LogDumpBp(LOG_HDLC, "HdlcOutput", mhp); + LogDumpBp(LogHDLC, "HdlcOutput", mhp); for (statp = ProtocolStat; statp->number; statp++) if (statp->number == proto) break; @@ -200,11 +200,10 @@ HdlcOutput(int pri, u_short proto, struct mbuf *bp) void DecodePacket(u_short proto, struct mbuf *bp) { -#ifdef DEBUG - logprintf("proto = %04x\n", proto); -#endif u_char *cp; + LogPrintf(LogDEBUG, "DecodePacket: proto = %04x\n", proto); + switch (proto) { case PROTO_LCP: LcpInput(bp); @@ -239,7 +238,7 @@ DecodePacket(u_short proto, struct mbuf *bp) Pred1Input(bp); break; default: - LogPrintf(LOG_PHASE_BIT, "Unknown protocol 0x%04x\n", proto); + LogPrintf(LogPHASE, "Unknown protocol 0x%04x\n", proto); bp->offset -= 2; bp->cnt += 2; cp = MBUF_CTOP(bp); @@ -260,18 +259,18 @@ ReportProtStatus() statp = ProtocolStat; statp--; cnt = 0; - printf(" Protocol in out Protocol in out\n"); + fprintf(VarTerm, " Protocol in out Protocol in out\n"); do { statp++; - printf(" %-9s: %8lu, %8lu", + fprintf(VarTerm, " %-9s: %8lu, %8lu", statp->name, statp->in_count, statp->out_count); if (++cnt == 2) { - printf("\n"); + fprintf(VarTerm, "\n"); cnt = 0; } } while (statp->number); if (cnt) - printf("\n"); + fprintf(VarTerm, "\n"); return(1); } @@ -280,10 +279,12 @@ ReportHdlcStatus() { struct hdlcstat *hp = &HdlcStat; - printf("HDLC level errors\n\n"); - printf("FCS: %u ADDR: %u COMMAND: %u PROTO: %u\n", - hp->badfcs, hp->badaddr, hp->badcommand, hp->unknownproto); - return(1); + if (VarTerm) { + fprintf(VarTerm, "HDLC level errors\n\n"); + fprintf(VarTerm, "FCS: %u ADDR: %u COMMAND: %u PROTO: %u\n", + hp->badfcs, hp->badaddr, hp->badcommand, hp->unknownproto); + } + return 0; } static struct hdlcstat laststat; @@ -295,7 +296,7 @@ HdlcErrorCheck() struct hdlcstat *op = &laststat; if (bcmp(hp, op, sizeof(laststat))) { - LogPrintf(LOG_PHASE_BIT, "HDLC errors -> FCS: %u ADDR: %u COMD: %u PROTO: %u\n", + LogPrintf(LogPHASE, "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); } @@ -309,21 +310,18 @@ HdlcInput(struct mbuf *bp) u_char *cp, addr, ctrl; struct protostat *statp; - LogDumpBp(LOG_HDLC, "HdlcInput:", bp); + LogDumpBp(LogHDLC, "HdlcInput:", bp); if (DEV_IS_SYNC) fcs = GOODFCS; else fcs = HdlcFcs(INITFCS, MBUF_CTOP(bp), bp->cnt); HisLqrSave.SaveInOctets += bp->cnt + 1; -#ifdef DEBUG - logprintf("fcs = %04x (%s)\n", fcs, (fcs == GOODFCS)? "good" : "bad"); -#endif + LogPrintf(LogDEBUG, "HdlcInput: fcs = %04x (%s)\n", + fcs, (fcs == GOODFCS)? "good" : "bad"); if (fcs != GOODFCS) { HisLqrSave.SaveInErrors++; -#ifdef DEBUG - logprintf("Bad FCS\n"); -#endif + LogPrintf(LogDEBUG, "HdlcInput: Bad FCS\n"); HdlcStat.badfcs++; pfree(bp); return; @@ -349,9 +347,7 @@ HdlcInput(struct mbuf *bp) if (addr != HDLC_ADDR) { HisLqrSave.SaveInErrors++; HdlcStat.badaddr++; -#ifdef DEBUG - logprintf("addr %02x\n", *cp); -#endif + LogPrintf(LogDEBUG, "HdlcInput: addr %02x\n", *cp); pfree(bp); return; } @@ -360,9 +356,7 @@ HdlcInput(struct mbuf *bp) if (ctrl != HDLC_UI) { HisLqrSave.SaveInErrors++; HdlcStat.badcommand++; -#ifdef DEBUG - logprintf("command %02x\n", *cp); -#endif + LogPrintf(LogDEBUG, "HdlcInput: %02x\n", *cp); pfree(bp); return; } |