From owner-freebsd-net Fri Dec 13 5:57:11 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0472737B401 for ; Fri, 13 Dec 2002 05:57:10 -0800 (PST) Received: from silver.he.iki.fi (silver.he.iki.fi [193.64.42.241]) by mx1.FreeBSD.org (Postfix) with ESMTP id AC2AD43EB2 for ; Fri, 13 Dec 2002 05:57:08 -0800 (PST) (envelope-from pete@he.iki.fi) Received: from he.iki.fi (localhost.he.iki.fi [127.0.0.1]) by silver.he.iki.fi (8.12.6/8.11.4) with ESMTP id gBDDtvuO072361; Fri, 13 Dec 2002 15:56:02 +0200 (EET) (envelope-from pete@he.iki.fi) Message-ID: <3DF9E6ED.6030205@he.iki.fi> Date: Fri, 13 Dec 2002 15:55:57 +0200 From: Petri Helenius User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.1) Gecko/20021117 X-Accept-Language: English [en],Finnish [fi] MIME-Version: 1.0 To: Richard A Steenbergen Cc: freebsd-net@FreeBSD.ORG Subject: Re: libpcap References: <3DF9B5A6.4070603@he.iki.fi> <20021213131356.GF56949@overlord.e-gerbil.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Richard A Steenbergen wrote: >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): > > That's what we have done, the problem is that every time the source tree is brought up to RELENG_4_7 or RELENG_4 the change needs to be reapplied, so that's why the appeal to fix it at the source. > /* > * 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. > > I think the libpcap code should not touch a parameter: - which has a system settable default - which is accessible to an application Specifically since it cannot be set either before or after the pcap stuff initialized. >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). > > If I do move somewhere, moving away from bpf (and libpcap) would only improve performance. It's more work but eventually a must. Pete > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message