The PPP Daemon is the userland part of the Point-to-Point Protocol. It works in combination with a dedicated kernel network interface usually named ppp. PPP is a very extensible protocol and pppd supports a large number of options, including compression (through various algorithms), cryptography (Microsoft's MPPE) and authentication (PAP, CHAP, Microsoft CHAP), provided the kernel has the relevant back-ends in some cases.
99 lines
2.2 KiB
Text
99 lines
2.2 KiB
Text
$NetBSD: patch-bi,v 1.1.1.1 2005/01/02 02:51:44 cube Exp $
|
|
|
|
--- pppdump/pppdump.c.orig 2004-02-02 04:36:46.000000000 +0100
|
|
+++ pppdump/pppdump.c
|
|
@@ -38,8 +38,13 @@
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <sys/types.h>
|
|
-#include "ppp_defs.h"
|
|
+#include "pppdump.h"
|
|
+#include <net/ppp_defs.h>
|
|
+#ifdef __NetBSD__
|
|
+#include <net/ppp-comp.h>
|
|
+#else
|
|
#include "ppp-comp.h"
|
|
+#endif
|
|
|
|
int hexmode;
|
|
int pppmode;
|
|
@@ -51,6 +56,15 @@ time_t start_time;
|
|
int start_time_tenths;
|
|
int tot_sent, tot_rcvd;
|
|
|
|
+struct pkt {
|
|
+ int cnt;
|
|
+ int esc;
|
|
+ int flags;
|
|
+ struct compressor *comp;
|
|
+ void *state;
|
|
+ unsigned char buf[8192];
|
|
+} spkt, rpkt;
|
|
+
|
|
extern int optind;
|
|
extern char *optarg;
|
|
|
|
@@ -191,7 +205,7 @@ dumplog(f)
|
|
show_time(f, c);
|
|
break;
|
|
default:
|
|
- printf("?%.2x\n");
|
|
+ printf("?%.2x\n", c);
|
|
}
|
|
}
|
|
}
|
|
@@ -234,15 +248,6 @@ static u_short fcstab[256] = {
|
|
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
|
|
};
|
|
|
|
-struct pkt {
|
|
- int cnt;
|
|
- int esc;
|
|
- int flags;
|
|
- struct compressor *comp;
|
|
- void *state;
|
|
- unsigned char buf[8192];
|
|
-} spkt, rpkt;
|
|
-
|
|
/* Values for flags */
|
|
#define CCP_ISUP 1
|
|
#define CCP_ERROR 2
|
|
@@ -321,7 +326,7 @@ dumpppp(f)
|
|
++r;
|
|
if (endp - r > mru)
|
|
printf(" ERROR: length (%d) > MRU (%d)\n",
|
|
- endp - r, mru);
|
|
+ (int)(endp - r), mru);
|
|
if (decompress && fcs == PPP_GOODFCS) {
|
|
/* See if this is a CCP or compressed packet */
|
|
d = dbuf;
|
|
@@ -340,8 +345,15 @@ dumpppp(f)
|
|
&& (pkt->flags & CCP_DECOMP_RUN)
|
|
&& pkt->state
|
|
&& (pkt->flags & CCP_ERR) == 0) {
|
|
- rv = pkt->comp->decompress(pkt->state, r,
|
|
- endp - r, d, &dn);
|
|
+ struct packet in, out, *outp;
|
|
+ in.buf = r;
|
|
+ in.len = endp - r;
|
|
+ out.buf = d;
|
|
+ outp = &out;
|
|
+ rv = pkt->comp->decompress(pkt->state, &in,
|
|
+ &outp);
|
|
+ dn = outp->len;
|
|
+ d = outp->buf;
|
|
switch (rv) {
|
|
case DECOMP_OK:
|
|
p = dbuf;
|
|
@@ -364,7 +376,10 @@ dumpppp(f)
|
|
}
|
|
} else if (pkt->state
|
|
&& (pkt->flags & CCP_DECOMP_RUN)) {
|
|
- pkt->comp->incomp(pkt->state, r, endp - r);
|
|
+ struct packet in;
|
|
+ in.buf = r;
|
|
+ in.len = endp - r;
|
|
+ pkt->comp->incomp(pkt->state, &in);
|
|
}
|
|
}
|
|
do {
|