#include <stdlib.h>
#include <string.h>
+#include <setjmp.h>
#include "netdissect-stdinc.h"
#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
#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 */
#endif
#ifdef DLT_PPP_SERIAL
{ ppp_hdlc_if_print, DLT_PPP_SERIAL },
+#endif
+#ifdef DLT_DSA_TAG_BRCM
+ { brcm_tag_if_print, DLT_DSA_TAG_BRCM },
+#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 },
};
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)
*/
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