summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-11-12 01:12:09 +0000
committerdlg <dlg@openbsd.org>2013-11-12 01:12:09 +0000
commit0b3758079b655c489ca9a0bf1500c9ccc4ff368c (patch)
treeb979468c988abd81f8e25a089552c4756df261f6
parentunused variable (diff)
downloadwireguard-openbsd-0b3758079b655c489ca9a0bf1500c9ccc4ff368c.tar.xz
wireguard-openbsd-0b3758079b655c489ca9a0bf1500c9ccc4ff368c.zip
try bpf.c r1.84 again, this time without semantic changes to if statements.
cheers to sthen@ and krw@ for properly dealing with the fallout of my first commit.
-rw-r--r--sys/net/bpf.c13
-rw-r--r--sys/net/bpfdesc.h6
2 files changed, 9 insertions, 10 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index b629e317d8d..332c72a4bda 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.85 2013/11/11 16:21:08 sthen Exp $ */
+/* $OpenBSD: bpf.c,v 1.86 2013/11/12 01:12:09 dlg Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1422,17 +1422,16 @@ bpf_catchpacket(struct bpf_d *d, u_char *pkt, size_t pktlen, size_t snaplen,
bpf_wakeup(d);
}
- if (d->bd_rdStart && (d->bd_rtout + d->bd_rdStart < ticks)) {
+ if (d->bd_fbuf && d->bd_rdStart &&
+ (ticks - d->bd_rdStart > d->bd_rtout)) {
/*
* 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.
*/
- if (d->bd_fbuf) {
- d->bd_rdStart = 0;
- ROTATE_BUFFERS(d);
- bpf_wakeup(d);
- }
+ d->bd_rdStart = 0;
+ ROTATE_BUFFERS(d);
+ bpf_wakeup(d);
}
}
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 1ca5afb7307..700e91d8eca 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpfdesc.h,v 1.20 2013/11/11 16:21:08 sthen Exp $ */
+/* $OpenBSD: bpfdesc.h,v 1.21 2013/11/12 01:12:09 dlg 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 */
- u_long bd_rtout; /* Read timeout in 'ticks' */
- u_long bd_rdStart; /* when the read started */
+ int bd_rtout; /* Read timeout in 'ticks' */
+ int 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 */