]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print.c
the failed/passed count was not kept in the right place
[tcpdump] / print.c
diff --git a/print.c b/print.c
index 9ee88eb1758d1206b256043c8b0c47dd7e388f26..418658ea5d4b9c6c356bea9dbf92c0dda77bf001 100644 (file)
--- a/print.c
+++ b/print.c
@@ -31,6 +31,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <setjmp.h>
 
 #include "netdissect-stdinc.h"
 
@@ -57,6 +58,9 @@ static const struct printer printers[] = {
 #ifdef DLT_IEEE802_15_4_NOFCS
        { ieee802_15_4_if_print, DLT_IEEE802_15_4_NOFCS },
 #endif
+#ifdef DLT_IEEE802_15_4_TAP
+       { ieee802_15_4_tap_if_print, DLT_IEEE802_15_4_TAP },
+#endif
 #ifdef DLT_PPI
        { ppi_if_print,         DLT_PPI },
 #endif
@@ -102,6 +106,9 @@ static const struct printer printers[] = {
 #ifdef DLT_IPV6
        { raw_if_print,         DLT_IPV6 },
 #endif
+#ifdef DLT_IPOIB
+       { ipoib_if_print,       DLT_IPOIB },
+#endif
 #ifdef DLT_USB_LINUX
        { usb_linux_48_byte_if_print, DLT_USB_LINUX},
 #endif /* DLT_USB_LINUX */
@@ -229,6 +236,15 @@ static const struct printer printers[] = {
 #endif
 #ifdef DLT_DSA_TAG_BRCM_PREPEND
        { brcm_tag_prepend_if_print, DLT_DSA_TAG_BRCM_PREPEND },
+#endif
+#ifdef DLT_VSOCK
+       { vsock_if_print,       DLT_VSOCK },
+#endif
+#ifdef DLT_DSA_TAG_DSA
+       { dsa_if_print, DLT_DSA_TAG_DSA },
+#endif
+#ifdef DLT_DSA_TAG_EDSA
+       { edsa_if_print,        DLT_DSA_TAG_EDSA },
 #endif
        { NULL,                 0 },
 };
@@ -323,7 +339,7 @@ void
 pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
                    const u_char *sp, u_int packets_captured)
 {
-       u_int hdrlen;
+       u_int hdrlen = 0;
        int invalid_header = 0;
 
        if (ndo->ndo_packet_number)
@@ -392,7 +408,22 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
         */
        ndo->ndo_snapend = sp + h->caplen;
 
-       hdrlen = (ndo->ndo_if_printer)(ndo, h, sp);
+       ndo->ndo_protocol = "";
+       if (setjmp(ndo->ndo_truncated) == 0) {
+               /* Print the packet. */
+               hdrlen = (ndo->ndo_if_printer)(ndo, h, sp);
+       } else {
+               /* A printer quit because the packet was truncated; report it */
+               ND_PRINT(" [|%s]", ndo->ndo_protocol);
+       }
+
+       /*
+        * Empty the stack of packet information, freeing all pushed buffers;
+        * if we got here by a printer quitting, we need to release anything
+        * that didn't get released because we longjmped out of the code
+        * before it popped the packet information.
+        */
+       nd_pop_all_packet_info(ndo);
 
        /*
         * Restore the original snapend, as a printer might have