]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppp.c
Make "-x" and "-X" work with PPPoE interfaces; based on code from Darren
[tcpdump] / print-ppp.c
index 614248b076816b149c8ef2e312ad7f6a7cc82273..597898534aad8d86d520e1f9edfbcddaf27f8542 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.65 2001-10-24 03:49:19 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.66 2002-05-29 10:32:02 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -990,11 +990,12 @@ handle_ppp(u_int proto, const u_char *p, int length)
 }
 
 /* Standard PPP printer */
-void
+u_int
 ppp_print(register const u_char *p, u_int length)
 {
        u_int proto;
        u_int full_length = length;
+       u_int hdr_len = 0;
 
        /*
         * Here, we assume that p points to the Address and Control
@@ -1005,6 +1006,7 @@ ppp_print(register const u_char *p, u_int length)
        if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
                p += 2;                 /* ACFC not used */
                length -= 2;
+               hdr_len += 2;
        }
 
        if (length < 2)
@@ -1013,18 +1015,21 @@ ppp_print(register const u_char *p, u_int length)
                proto = *p;             /* PFC is used */
                p++;
                length--;
+               hdr_len++;
        } else {
                proto = EXTRACT_16BITS(p);
                p += 2;
                length -= 2;
+               hdr_len += 2;
        }
 
        printf("%s %d: ", ppp_protoname(proto), full_length);
 
        handle_ppp(proto, p, length);
-       return;
+       return (hdr_len);
 trunc:
        printf("[|ppp]");
+       return (0);
 }