]> The Tcpdump Group git mirrors - tcpdump/blobdiff - tcpdump.c
updated print-ipnet.c to use netdissect options structure
[tcpdump] / tcpdump.c
index c915ae47c22a8eac015d3b335bf440487e7ead1b..25feb7a04457083ffa55abc51ee0c9eb0b1a80e4 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -281,6 +281,9 @@ static struct printer printers[] = {
 #endif
 #if defined(HAVE_PCAP_USB_H) && defined(DLT_USB_LINUX_MMAPPED)
        { usb_linux_print, DLT_USB_LINUX_MMAPPED},
+#endif
+#ifdef DLT_IPNET
+       { ipnet_if_print, DLT_IPNET },
 #endif
        { NULL,                 0 },
 };
@@ -1303,6 +1306,11 @@ info(register int verbose)
 {
        struct pcap_stat stat;
 
+       /*
+        * Older versions of libpcap didn't set ps_ifdrop on some
+        * platforms; initialize it to 0 to handle that.
+        */
+       stat.ps_ifdrop = 0;
        if (pcap_stats(pd, &stat) < 0) {
                (void)fprintf(stderr, "pcap_stats: %s\n", pcap_geterr(pd));
                infoprint = 0;
@@ -1317,12 +1325,21 @@ info(register int verbose)
                fputs(", ", stderr);
        else
                putc('\n', stderr);
-       (void)fprintf(stderr, "%d packets received by filter", stat.ps_recv);
+       (void)fprintf(stderr, "%u packets received by filter", stat.ps_recv);
        if (!verbose)
                fputs(", ", stderr);
        else
                putc('\n', stderr);
-       (void)fprintf(stderr, "%d packets dropped by kernel\n", stat.ps_drop);
+       (void)fprintf(stderr, "%u packets dropped by kernel", stat.ps_drop);
+       if (stat.ps_ifdrop != 0) {
+               if (!verbose)
+                       fputs(", ", stderr);
+               else
+                       putc('\n', stderr);
+               (void)fprintf(stderr, "%u packets dropped by interface\n",
+                   stat.ps_ifdrop);
+       } else
+               putc('\n', stderr);
        infoprint = 0;
 }
 
@@ -1340,7 +1357,7 @@ compress_savefile(const char *filename)
 #else
        setpriority(PRIO_PROCESS, 0, 19);
 #endif
-       if (execlp(zflag, zflag, filename, NULL) == -1)
+       if (execlp(zflag, zflag, filename, (char *)NULL) == -1)
                fprintf(stderr,
                        "compress_savefile:execlp(%s, %s): %s\n",
                        zflag,