Why are tcpdump packets being dropped by interface

tcpdump

I'm using Ubuntu 14.04 via Virtual Box on a Windows 7 host. The NIC is a USB to Ethernet adapter.

The man for tcpdump states what can cause "packets dropped by kernel" but it doesn't state what causes "packets dropped by interface".

Can anyone shed some light as to why the interface may be dropping packets? Or how I can find out the reason for it dropping the packets?

Best Answer

As you pointed out, there is nothing in the documentation about the "packets dropped by interface" counter. So we need some source code digging.

From the source code of tcpdump, the interface drop counter is extracted from stats.ps_ifdrop:

if (stats.ps_ifdrop != 0) {
    if (!verbose)
        fputs(", ", stderr);
    else
        putc('\n', stderr);
    (void)fprintf(stderr, "%u packet%s dropped by interface\n",
        stats.ps_ifdrop, PLURAL_SUFFIX(stats.ps_ifdrop));

From man pcap_stats:

ps_ifdrop
    number of packets dropped by the network interface or its driver.

And from the libpcap source code:

 *  "ps_ifdrop" is supported. It will return the number
 *  of drops the interface reports in /proc/net/dev,
 *  if that is available.

So the tcpdump "packets dropped by interface" counter corresponds to the packets logged as dropped in /proc/net/dev during the tcpdump capture.

The meaning of the /proc/dev/net fields are explained here

To get a better understanding of the drops, I would start by looking at the following statistics:

  • ethtool -S <interface>
  • grep '' /sys/class/net/<interface>/statistics/*
Related Question