summaryrefslogtreecommitdiff
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2013-11-11 16:21:09 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2013-11-11 16:21:09 +0000
commit17fbd7f890852db781cbc739aa64911af9d6d1dd (patch)
tree14f989891feac0a9c7d744e5b7a88e797b2c06c9 /sys/net/bpf.c
parentd020414d1ab9f3ee949009c95a791f78769ac6d0 (diff)
Revert bpf.c 1.84 / bpfdesc.h 1.19 for now, "panic: timeout_add: to_ticks (-1)
< 0" seen by RD Thrush, http://article.gmane.org/gmane.os.openbsd.bugs/20113 where he has a long-running process using bpf which is active at the time of panic. krw@ agrees with reverting for now.
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index f11ebb014a8..b629e317d8d 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.84 2013/11/11 03:06:43 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.85 2013/11/11 16:21:08 sthen Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1420,16 +1420,19 @@ bpf_catchpacket(struct bpf_d *d, u_char *pkt, size_t pktlen, size_t snaplen,
* reads should be woken up.
*/
bpf_wakeup(d);
- } else if (d->bd_fbuf && d->bd_rdStart &&
- (ticks - d->bd_rdStart > d->bd_rtout)) {
+ }
+
+ if (d->bd_rdStart && (d->bd_rtout + d->bd_rdStart < ticks)) {
/*
* we could be selecting on the bpf, and we
* may have timeouts set. We got here by getting
* a packet, so wake up the reader.
*/
- d->bd_rdStart = 0;
- ROTATE_BUFFERS(d);
- bpf_wakeup(d);
+ if (d->bd_fbuf) {
+ d->bd_rdStart = 0;
+ ROTATE_BUFFERS(d);
+ bpf_wakeup(d);
+ }
}
}