X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/a82daa17d6dee1f96fd0194aaf9ddf1bb6eb769a..052094d865be2d613f1e0ec7c220f9e4d38a0b22:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index 26d1d804..25feb7a0 100644 --- 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; @@ -1322,7 +1330,16 @@ info(register int verbose) fputs(", ", stderr); else putc('\n', stderr); - (void)fprintf(stderr, "%u 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; }