X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/be43281053727d9a32c479813fd0ec79bdaf2dda..HEAD:/print.c diff --git a/print.c b/print.c index b595a882..f67597e3 100644 --- a/print.c +++ b/print.c @@ -25,9 +25,7 @@ * Seth Webster */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include @@ -40,8 +38,6 @@ #include "print.h" #include "netdissect-alloc.h" -#include "pcap-missing.h" - struct printer { if_printer f; int type; @@ -194,9 +190,6 @@ static const struct printer printers[] = { #ifdef DLT_PPI { ppi_if_print, DLT_PPI }, #endif -#ifdef DLT_PPP_BSDOS - { ppp_bsdos_if_print, DLT_PPP_BSDOS }, -#endif #ifdef DLT_PPP_SERIAL { ppp_hdlc_if_print, DLT_PPP_SERIAL }, #endif @@ -246,12 +239,11 @@ static const struct printer printers[] = { { NULL, 0 }, }; +// Both localnet and mask are in network byte order. void init_print(netdissect_options *ndo, uint32_t localnet, uint32_t mask) { - init_addrtoname(ndo, localnet, mask); - init_checksum(); } if_printer @@ -331,6 +323,9 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h, if (ndo->ndo_packet_number) ND_PRINT("%5u ", packets_captured); + if (ndo->ndo_lengths) + ND_PRINT("caplen %u len %u ", h->caplen, h->len); + /* Sanity checks on packet length / capture length */ if (h->caplen == 0) { invalid_header = 1; @@ -421,13 +416,6 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h, profile_func_level = pretty_print_packet_level; #endif break; - case ND_BUG: - /* - * A printer or helper routine quit because a bug was - * detected; report it. - */ - ND_PRINT(" [Bug in %s protocol printer]", ndo->ndo_protocol); - break; } hdrlen = ndo->ndo_ll_hdr_len; @@ -440,10 +428,14 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h, nd_pop_all_packet_info(ndo); /* - * Restore the original snapend, as a printer might have - * changed it. + * Restore the originals snapend and packetp, as a printer + * might have changed them. + * + * XXX - nd_pop_all_packet_info() should have restored the + * original values, but, just in case.... */ ndo->ndo_snapend = sp + h->caplen; + ndo->ndo_packetp = sp; if (ndo->ndo_Xflag) { /* * Print the raw packet data in hex and ASCII.