]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ppp.c
Get rid of unneeded includes of <netinet/in_systm.h> and <netinet/ip.h>.
[tcpdump] / print-ppp.c
index 0739076aa7985f6c5626408a7285eec9fff6a272..597898534aad8d86d520e1f9edfbcddaf27f8542 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.64 2001-09-09 02:04:19 guy 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,19 +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;
        }
 
-       if (eflag)
-               printf("%s %d: ", ppp_protoname(proto), full_length);
+       printf("%s %d: ", ppp_protoname(proto), full_length);
 
        handle_ppp(proto, p, length);
-       return;
+       return (hdr_len);
 trunc:
        printf("[|ppp]");
+       return (0);
 }
 
 
@@ -1154,8 +1158,7 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
                proto = EXTRACT_16BITS(p);
                p += 2;
                length -= 2;
-               if (eflag)
-                       printf("%s: ", ppp_protoname(proto));
+               printf("%s: ", ppp_protoname(proto));
 
                handle_ppp(proto, p, length);
                break;