diff options
author | phk <phk@FreeBSD.org> | 2000-01-15 19:46:12 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-01-15 19:46:12 +0000 |
commit | d462c28c31df9f3914c6ca7a927dd720a96662e6 (patch) | |
tree | e582bf4525019087e6d3c7443980365ddb9ad9a5 /sys | |
parent | 573e577b6fdd9128ba293a8bd68b8648fd0bf704 (diff) | |
download | FreeBSD-src-d462c28c31df9f3914c6ca7a927dd720a96662e6.zip FreeBSD-src-d462c28c31df9f3914c6ca7a927dd720a96662e6.tar.gz |
|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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bpf.c | 7 | ||||
-rw-r--r-- | 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 3ac4283..d75013e 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 9b04c82..a684314 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 /* |