tcpdump mailing list archives
Re: [PATCH] Re: Bug: Counting dropped packets in linux
From: Guy Harris <guy () alum mit edu>
Date: Mon, 31 Aug 2009 18:25:42 -0700
On Aug 28, 2009, at 1:24 PM, Dustin Spicuzza wrote:
Dustin Spicuzza wrote:So after reading the libpcap and kernel source, I see that this isactually how its supposed to work. But it *seems* like it would be quitenice if we could grab the interface driver drop statistics as well as drops resulting from the capture buffer filling up.I'm looking for a way to query the kernel about this number -- should Ibother submitting a patch if I can get it, or is the current behavior more desired?It appears that the only way to get this number is by looking at/proc/stats/dev, so I added something that can parse it for the correct interface, and get the drop stats from there. Since those are cumulativeover the boot time of the system, it stores a number and does incremental updates of the number. It doesn't do this when not in promiscuous mode however, since that doesn't make any sense. It works for me, let me know what you think.
I think that
+ handle->md.stat.ps_drop += (handle->md.proc_dropped - if_dropped);
and
+ stats->ps_drop = handle->md.stat.ps_drop;
are wrong, because ps_drop is supposed to reflect the number of packets dropped by the packet capture mechanism because they arrived faster than the app could consume them, but not the number of packets dropped by the adapter or adapter driver before they even made it to the capture mechanism. ps_ifdrop is for the latter (and the comment about it being unimplemented is false on Tru64 UNIX, for example, so don't let that comment scare you off).
- This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- Bug: Counting dropped packets in linux Dustin Spicuzza (Aug 27)
- Re: Bug: Counting dropped packets in linux Dustin Spicuzza (Aug 27)
- [PATCH] Re: Bug: Counting dropped packets in linux Dustin Spicuzza (Aug 28)
- Re: [PATCH] Re: Bug: Counting dropped packets in Stephen Donnelly (Aug 30)
- Re: [PATCH] Re: Bug: Counting dropped packets in Guy Harris (Sep 01)
- Re: [PATCH] Re: Bug: Counting dropped packets in Dustin Spicuzza (Sep 01)
- Re: [PATCH] Re: Bug: Counting dropped packets in Guy Harris (Sep 07)
- Re: [PATCH] Re: Bug: Counting dropped packets in Dustin Spicuzza (Sep 17)
- Re: [PATCH] Re: Bug: Counting dropped packets in Guy Harris (Sep 21)
- [PATCH] Re: Bug: Counting dropped packets in linux Dustin Spicuzza (Aug 28)
- Re: Bug: Counting dropped packets in linux Dustin Spicuzza (Aug 27)
- Re: [PATCH] Re: Bug: Counting dropped packets in linux Guy Harris (Sep 01)
- Re: [PATCH] Re: Bug: Counting dropped packets in Dustin Spicuzza (Sep 02)