|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
This commit is contained in:
parent
f6ac6875d7
commit
eba2a1aeb9
@ -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;
|
||||
|
@ -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
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user