summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-01-29 19:44:32 +0000
committertedu <tedu@openbsd.org>2015-01-29 19:44:32 +0000
commit929b5be7523f6162dc38733d1cd5da7b97bf4321 (patch)
tree915cd8f4adafd8c5bb6de2d34f72d77d988569c9
parentCorrect buffer overflow in handling of pax extension headers, caught (diff)
downloadwireguard-openbsd-929b5be7523f6162dc38733d1cd5da7b97bf4321.tar.xz
wireguard-openbsd-929b5be7523f6162dc38733d1cd5da7b97bf4321.zip
back bpf.c down to 1.113, from before most recent timeout changes.
nmap is broken, as reported by kent fritz. pending further investigation, we should keep nmap working until a better fix is developed for the original problem.
-rw-r--r--sys/net/bpf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 76396338968..73648a532bd 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.115 2015/01/28 00:31:07 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.116 2015/01/29 19:44:32 tedu Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -430,14 +430,10 @@ bpfread(dev_t dev, struct uio *uio, int ioflag)
if (d->bd_rtout == -1) {
/* User requested non-blocking I/O */
error = EWOULDBLOCK;
- } else if (d->bd_rtout == 0) {
- error = tsleep(d, PRINET|PCATCH, "bpf", 0);
} else {
- int elapsed = ticks - d->bd_rdStart;
- if (elapsed < d->bd_rtout) {
- error = tsleep(d, PRINET|PCATCH, "bpf",
- d->bd_rtout - elapsed);
- d->bd_rdStart = 0;
+ if ((d->bd_rdStart + d->bd_rtout) < ticks) {
+ error = tsleep((caddr_t)d, PRINET|PCATCH, "bpf",
+ d->bd_rtout);
} else
error = EWOULDBLOCK;
}