]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print.c
diff --git a/print.c b/print.c
index b9ba5997d789c48ce1ba243864d33b5ed1bb158a..f67597e3a51a3aaeeb1d1e4cd1f1c851ef7463eb 100644 (file)
--- a/print.c
+++ b/print.c
@@ -25,9 +25,7 @@
  *     Seth Webster <[email protected]>
  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <stdlib.h>
 #include <string.h>
@@ -40,8 +38,6 @@
 #include "print.h"
 #include "netdissect-alloc.h"
 
-#include "pcap-missing.h"
-
 struct printer {
        if_printer f;
        int type;
@@ -243,6 +239,7 @@ 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)
 {
@@ -431,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.