Ticket #18 (closed Patch: Solved)
Packet drop numbers incorrect on Linux with new libpcap
| Reported by: | pw@… | Owned by: | vern |
|---|---|---|---|
| Priority: | High | Component: | Bro |
| Version: | 1.5.2-devel (svn) | Keywords: | |
| Cc: | jones@… |
Description
This issue is a followup to the mailinglist post http://mailman.icsi.berkeley.edu/pipermail/bro/2008-November/003843.html
The number of packet drops reported by Bro is not always correct. Here is a detailed explanation:
Bro queries the libpcap component in order to get the number of dropped packets, using the pcap_stats function. The responsible code in PktSrc::Statistics() distinguishes between Linux and FreeBSD systems. It is assumed that for Linux the value delivered by pcap_stats gives the number of drops since the last query, whereas on FreeBSD it gives the number of drops since the start of the current Bro run. It seems, that for certain older libpcap versions this assumption was correct, even though, by specification, pcap_stats should always give a cumulative count of drops. However, due to a bug in libpcap, its behavior deviated on Linux systems, requiring the mentioned distinction of the OSes in the Bro code.
It seems, that this bug in libpcap has been fixed in the meantime, and starting from version 0.9 the Linux behavior correctly matches the specification again, and thus, also matches the behavior of FreeBSD. Check: http://www.archivum.info/debian-bugs-closed@lists.debian.org/2005-06/msg00488.html
Therefore, on Linux systems running libpcap versions > 0.9 the packet drop numbers reported by Bro are wrong. I have experienced this problem on my machine running Debian Lenny and libpcap 0.9.8. I was able to fix it by simply using the FreeBSD branch of the code. Probably, it is no longer suitable to make the distinction based solely on the OS, but one should take into consideration the libpcap version as well.
