From eba2a1aeb902924c56db1043ea9f397def94ee34 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 15 Jan 2000 19:46:12 +0000 Subject: [PATCH] |The hard limit for the BPF buffer size is 32KB, which appears too low |for high speed networks (even at 100Mbit/s this corresponds to 1/300th |of a second). The default buffer size is 4KB, but libpcap and ipfilter |both override this (using the BIOCSBLEN ioctl) and allocate 32KB. | |The following patch adds an sysctl for bpf_maxbufsize, similar to the |one for bpf_bufsize that you added back in December 1995. I choose to |make the default for this limit 512KB (the value suggested by NFR). Submitted by: se Reviewed by: phk --- sys/net/bpf.c | 7 +++++-- sys/net/bpf.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 3ac42830f13..d75013e4cd5 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -104,6 +104,9 @@ static caddr_t bpf_alloc(); static int bpf_bufsize = BPF_BUFSIZE; SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, &bpf_bufsize, 0, ""); +static int bpf_maxbufsize = BPF_MAXBUFSIZE; +SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW, + &bpf_maxbufsize, 0, ""); /* * bpf_iflist is the list of interfaces; each corresponds to an ifnet @@ -698,8 +701,8 @@ bpfioctl(dev, cmd, addr, flags, p) else { register u_int size = *(u_int *)addr; - if (size > BPF_MAXBUFSIZE) - *(u_int *)addr = size = BPF_MAXBUFSIZE; + if (size > bpf_maxbufsize) + *(u_int *)addr = size = bpf_maxbufsize; else if (size < BPF_MINBUFSIZE) *(u_int *)addr = size = BPF_MINBUFSIZE; d->bd_bufsize = size; diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 9b04c82944c..a684314e684 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -58,7 +58,7 @@ typedef u_int32_t bpf_u_int32; #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) #define BPF_MAXINSNS 512 -#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MAXBUFSIZE 0x80000 #define BPF_MINBUFSIZE 32 /*