Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2002 08:13:56 -0500
From:      Richard A Steenbergen <ras@e-gerbil.net>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: libpcap
Message-ID:  <20021213131356.GF56949@overlord.e-gerbil.net>
In-Reply-To: <3DF9B5A6.4070603@he.iki.fi>
References:  <3DF9B5A6.4070603@he.iki.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 13, 2002 at 12:25:42PM +0200, Petri Helenius wrote:
> 
> Suggestions what would it take to make libpcap included in the FreeBSD 
> distribution
> stop tweaking BPF buffer size by default?
> 
> tcpdump.org people have been nonresponsive about changing it there, so I 
> would suggest
> it should be patched in FreeBSD to allow applications to control buffer 
> size.

Sure, fix the code starting at src/contrib/libpcap/pcap-bpf.c:236, which
even says (complete with outdated assumption that 32768 is big):

        /*
         * Try finding a good size for the buffer; 32768 may be too
         * big, so keep cutting it in half until we find a size
         * that works, or run out of sizes to try.
         *
         * XXX - there should be a user-accessible hook to set the
         * initial buffer size.
         */

The problem is, you can't add it as a parameter to any of the existing
functions without royally breaking existing code. You could add another
function for setting it, but that would still produce freebsd specific
code.  You could just remove that code completely, and let the sysctl
specified default take over, but where one libpcap application might have
use for a 1MB buffer another might be wasting it completely.

But changing stuff like this in FreeBSD pretty much defeats the purpose of
having a portable lib. I'd suggest either clubbing them over the head with
the need to fix it, modifying your local copy to suit your needs, or
better yet (since you obviously don't mind a fbsd specific hack) just use
bpf yourself (and you get bpf write functionality too :P).

-- 
Richard A Steenbergen <ras@e-gerbil.net>       http://www.e-gerbil.net/ras
GPG Key ID: 0xF8B12CBC (7535 7F59 8204 ED1F CC1C 53AF 4C41 5ECA F8B1 2CBC)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021213131356.GF56949>