summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-04-02 09:05:17 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-04-02 09:05:17 +0000
commit265ded1661027ce97c3afb983e296e09f95b2535 (patch)
treeeafe7b5c61187b8e44d28a543b22a9abbb4be235 /sys/net
parente5a0d0d70b99ccd066229eef52ecb6861bdc7f8e (diff)
mark the program and buffer as const in bpf_filter()
other projects have already done this, and there's software (eg, gopacket) which now expects it. based on a discussion with jasper@ and canacar@ ok jasper@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.h4
-rw-r--r--sys/net/bpf_filter.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 37887894867..27c676828e7 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.h,v 1.53 2016/04/02 08:49:49 dlg Exp $ */
+/* $OpenBSD: bpf.h,v 1.54 2016/04/02 09:05:16 dlg Exp $ */
/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */
/*
@@ -277,7 +277,7 @@ struct bpf_ops {
#define BPF_STMT(code, k) { (u_int16_t)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k }
-u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
+u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
u_int _bpf_filter(const struct bpf_insn *, const struct bpf_ops *,
const void *, u_int);
diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c
index 081d1592fd5..61418d652da 100644
--- a/sys/net/bpf_filter.c
+++ b/sys/net/bpf_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf_filter.c,v 1.28 2016/04/02 08:49:49 dlg Exp $ */
+/* $OpenBSD: bpf_filter.c,v 1.29 2016/04/02 09:05:16 dlg Exp $ */
/* $NetBSD: bpf_filter.c,v 1.12 1996/02/13 22:00:00 christos Exp $ */
/*
@@ -125,7 +125,8 @@ bpf_mem_ldb(const void *mem, u_int32_t k, int *err)
* buflen is the amount of data present
*/
u_int
-bpf_filter(struct bpf_insn *pc, u_char *pkt, u_int wirelen, u_int buflen)
+bpf_filter(const struct bpf_insn *pc, const u_char *pkt,
+ u_int wirelen, u_int buflen)
{
struct bpf_mem bm;