]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / tcpdump.c
index 11dc8bc8b854f356ccbe805ef0308357afbd637f..48c470000e9ce0c510dff0480e6e407841fad346 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -53,7 +53,7 @@ extern int SIZE_BUF;
 #define uint UINT
 #endif /* WIN32 */
 
-#ifdef HAVE_SMI_H
+#ifdef USE_LIBSMI
 #include <smi.h>
 #endif
 
@@ -954,7 +954,7 @@ main(int argc, char **argv)
        if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
                error("%s", ebuf);
 
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
        smiInit("tcpdump");
 #endif
 
@@ -1135,7 +1135,7 @@ main(int argc, char **argv)
                        break;
 
                case 'm':
-#ifdef LIBSMI
+#ifdef USE_LIBSMI
                        if (smiLoadModule(optarg) == 0) {
                                error("could not load MIB module %s", optarg);
                        }
@@ -2303,7 +2303,8 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
        /*
         * Some printers want to check that they're not walking off the
         * end of the packet.
-        * Rather than pass it all the way down, we set this global.
+        * Rather than pass it all the way down, we set this member
+        * of the netdissect_options structure.
         */
        ndo->ndo_snapend = sp + h->caplen;
 
@@ -2313,6 +2314,11 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
                 hdrlen = (*print_info->p.printer)(h, sp);
         }
 
+       /*
+        * Restore the original snapend, as a printer might have
+        * changed it.
+        */
+       ndo->ndo_snapend = sp + h->caplen;
        if (ndo->ndo_Xflag) {
                /*
                 * Print the raw packet data in hex and ASCII.
@@ -2487,7 +2493,7 @@ print_version(void)
        (void)fprintf (stderr, "%s\n", SSLeay_version(SSLEAY_VERSION));
 #endif
 
-#if defined(HAVE_SMI_H)
+#ifdef USE_LIBSMI
        (void)fprintf (stderr, "SMI-library: %s\n", smi_version_string);
 #endif
 }