]> 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 8ba6710bb7e55334d1ca3e95b41c059731e7b079..597898534aad8d86d520e1f9edfbcddaf27f8542 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.57 2000-12-04 06:47:18 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
@@ -347,18 +347,19 @@ ppp_protoname(u_int proto)
 
        switch (proto) {
        case PPP_IP:    return "IP";
+       case PPP_IPV6:  return "IPv6";
 #ifdef PPP_XNS
        case PPP_XNS:   return "XNS";
 #endif
        case PPP_IPX:   return "IPX";
+       case PPP_OSI:   return "OSI";
        case PPP_VJC:   return "VJC";
        case PPP_VJNC:  return "VJNC";
-#ifdef PPP_COMP
        case PPP_COMP:  return "COMP";
-#endif
        case PPP_IPCP:  return "IPCP";
-       case PPP_IPV6CP: return "IPV6CP";
+       case PPP_IPV6CP: return "IPv6CP";
        case PPP_IPXCP: return "IPXCP";
+       case PPP_OSICP: return "OSICP";
        case PPP_CCP:   return "CCP";
        case PPP_LCP:   return "LCP";
        case PPP_PAP:   return "PAP";
@@ -980,15 +981,21 @@ handle_ppp(u_int proto, const u_char *p, int length)
        case PPP_IPX:
                ipx_print(p, length);
                break;
+       case PPP_OSI:
+               isoclns_print(p, length, length, NULL, NULL);
+               break;
+       default:
+               break;
        }
 }
 
 /* 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
@@ -999,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)
@@ -1007,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);
 }
 
 
@@ -1030,6 +1041,7 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
        register u_int length = h->len;
        register u_int caplen = h->caplen;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < PPP_HDRLEN) {
@@ -1092,6 +1104,9 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
                default_print(p, caplen);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 /*
@@ -1111,6 +1126,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
        register u_int caplen = h->caplen;
        u_int proto;
 
+       ++infodelay;
+       ts_print(&h->ts);
+
        if (caplen < 2) {
                printf("[|ppp]");
                goto out;
@@ -1132,7 +1150,6 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
                        goto out;
                }
 
-               ts_print(&h->ts);
                if (eflag)
                        printf("%02x %02x %d ", p[0], p[1], length);
                p += 2;
@@ -1148,14 +1165,10 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
 
        case CHDLC_UNICAST:
        case CHDLC_BCAST:
-               /*
-                * Have the Cisco HDLC print routine do all the work.
-                */
-               chdlc_if_print(user, h, p);
-               return;
+               chdlc_print(p, length, caplen);
+               goto out;
 
        default:
-               ts_print(&h->ts);
                if (eflag)
                        printf("%02x %02x %d ", p[0], p[1], length);
                p += 2;
@@ -1174,6 +1187,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
                default_print(p, caplen);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 }
 
 
@@ -1228,6 +1244,7 @@ ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
        const u_char *q;
        int i;
 
+       ++infodelay;
        ts_print(&h->ts);
 
        if (caplen < PPP_BSDI_HDRLEN) {
@@ -1369,5 +1386,8 @@ printx:
                default_print((const u_char *)p, caplen - hdrlength);
 out:
        putchar('\n');
+       --infodelay;
+       if (infoprint)
+               info(0);
 #endif /* __bsdi__ */
 }