summaryrefslogtreecommitdiff
path: root/sys
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
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')
-rw-r--r--sys/net/bpf.c15
-rw-r--r--sys/net/bpfdesc.h6
2 files changed, 12 insertions, 9 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);
+ }
}
}
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 6ab7f053963..1ca5afb7307 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpfdesc.h,v 1.19 2013/11/11 03:06:43 dlg Exp $ */
+/* $OpenBSD: bpfdesc.h,v 1.20 2013/11/11 16:21:08 sthen Exp $ */
/* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */
/*
@@ -67,8 +67,8 @@ struct bpf_d {
int bd_bufsize; /* absolute length of buffers */
struct bpf_if * bd_bif; /* interface descriptor */
- int bd_rtout; /* Read timeout in 'ticks' */
- int bd_rdStart; /* when the read started */
+ u_long bd_rtout; /* Read timeout in 'ticks' */
+ u_long bd_rdStart; /* when the read started */
struct bpf_insn *bd_rfilter; /* read filter code */
struct bpf_insn *bd_wfilter; /* write filter code */
u_long bd_rcount; /* number of packets received */