From owner-freebsd-net Fri Dec 13 5:14:20 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 02CE937B401 for ; Fri, 13 Dec 2002 05:14:19 -0800 (PST) Received: from overlord.e-gerbil.net (e-gerbil.net [64.186.142.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 53B1043EB2 for ; Fri, 13 Dec 2002 05:14:18 -0800 (PST) (envelope-from ras@overlord.e-gerbil.net) Received: from overlord.e-gerbil.net (ras@localhost.globali.net [127.0.0.1]) by overlord.e-gerbil.net (8.12.6/8.12.6) with ESMTP id gBDDE4GQ069399; Fri, 13 Dec 2002 08:14:04 -0500 (EST) (envelope-from ras@overlord.e-gerbil.net) Received: (from ras@localhost) by overlord.e-gerbil.net (8.12.6/8.12.6/Submit) id gBDDDu5m069398; Fri, 13 Dec 2002 08:13:56 -0500 (EST) Date: Fri, 13 Dec 2002 08:13:56 -0500 From: Richard A Steenbergen To: Petri Helenius Cc: freebsd-net@FreeBSD.ORG Subject: Re: libpcap Message-ID: <20021213131356.GF56949@overlord.e-gerbil.net> References: <3DF9B5A6.4070603@he.iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DF9B5A6.4070603@he.iki.fi> User-Agent: Mutt/1.5.1i 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 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 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