summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/log.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-10-22 01:22:51 +0000
committerbrian <brian@FreeBSD.org>1997-10-22 01:22:51 +0000
commit9060aacb1ca06cf1c84acacc335788792c82ecee (patch)
tree15a9dc3aba35076fc51fed40a5ff9330d42cc486 /usr.sbin/ppp/log.c
parentc355e96630e195a54ba5874475af23594903ac39 (diff)
downloadFreeBSD-src-9060aacb1ca06cf1c84acacc335788792c82ecee.zip
FreeBSD-src-9060aacb1ca06cf1c84acacc335788792c82ecee.tar.gz
Fix HDLC logging (actually LogDumpBp()). It was only
outputting the first mbuf in the chain.
Diffstat (limited to 'usr.sbin/ppp/log.c')
-rw-r--r--usr.sbin/ppp/log.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c
index 4119f94..acec60b 100644
--- a/usr.sbin/ppp/log.c
+++ b/usr.sbin/ppp/log.c
@@ -131,7 +131,32 @@ LogPrintf(int lev, char *fmt,...)
void
LogDumpBp(int lev, char *hdr, struct mbuf * bp)
{
- LogDumpBuff(lev, hdr, MBUF_CTOP(bp), bp->cnt);
+ if (LogIsKept(lev)) {
+ char buf[49];
+ char *b;
+ u_char *ptr;
+ int f;
+
+ if (hdr && *hdr)
+ LogPrintf(lev, "%s\n", hdr);
+
+ b = buf;
+ do {
+ f = bp->cnt;
+ ptr = MBUF_CTOP(bp);
+ while (f--) {
+ sprintf(b, " %02x", (int) *ptr++);
+ b += 3;
+ if (b == buf + sizeof buf - 1) {
+ LogPrintf(lev, buf);
+ b = buf;
+ }
+ }
+ } while ((bp = bp->next) != NULL);
+
+ if (b > buf)
+ LogPrintf(lev, buf);
+ }
}
void
@@ -143,7 +168,7 @@ LogDumpBuff(int lev, char *hdr, u_char * ptr, int n)
int f;
if (hdr && *hdr)
- LogPrintf(lev, "%s", hdr);
+ LogPrintf(lev, "%s\n", hdr);
while (n > 0) {
b = buf;
for (f = 0; f < 16 && n--; f++, b += 3)
OpenPOWER on IntegriCloud