summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-03-25 07:41:33 +0000
committerrwatson <rwatson@FreeBSD.org>2008-03-25 07:41:33 +0000
commit59900e5206efb55f5382482d47a2f300d8a2b972 (patch)
treec85c0805ea0ddbb0b3701788f484d9d602cc5942 /sys/net/bpf.c
parent9a9594d179e3c5f3f47d805d0479f17ee4475f84 (diff)
downloadFreeBSD-src-59900e5206efb55f5382482d47a2f300d8a2b972.zip
FreeBSD-src-59900e5206efb55f5382482d47a2f300d8a2b972.tar.gz
Check for a NULL free buffer pointer in BPF before invoking
bpf_canfreebuf() in order to avoid potentially calling a non-inlinable but trivial function in zero-copy buffer mode for every packet received when we couldn't free the buffer anyway. MFC after: 4 months
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 433cc7a..eef3241 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1676,7 +1676,7 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen, u_int snaplen,
* run this check if we need the space), but for now it's a reliable
* spot to do it.
*/
- if (bpf_canfreebuf(d)) {
+ if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) {
d->bd_fbuf = d->bd_hbuf;
d->bd_hbuf = NULL;
d->bd_hlen = 0;
OpenPOWER on IntegriCloud