tcpdump mailing list archives

Re: Linux pcap_stats ignore kernel stats even when


From: Guy Harris <guy () alum mit edu>
Date: Wed, 22 Feb 2006 23:39:33 -0800

Alexander Dupuy wrote:

The crux of the problem is that the line with

    *stats = handle->md.stat;

was replaced with

    stats->ps_recv = handle->md.packets_read;
    stats->ps_drop = 0;

...rather than being executed, followed by a "return 0;", if we succeed in getting the statistics from the kernel.

I've checked in a change to put

        *stats = handle->md.stat;
        return 0;

in the "success" branch of the "getsockopt()" if statement. That means that if the getsockopt() call fails with EOPNOTSUPP (meaning the library was built with PACKET_STATISTICS support but is being run on a system without it), or if the code to make the getsockopt() call is missing (meaning the library was built without PACKET_STATISTICS support), it'll do the

        stats->ps_recv = handle->md.packets_read;
        stats->ps_drop = 0;

stuff.
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: