summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.h
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2018-01-24 00:25:17 +0000
committerdlg <dlg@openbsd.org>2018-01-24 00:25:17 +0000
commita60ac7a2fecea630cbc892141464020956782816 (patch)
tree99f610f90f49ca3a035c74ae1ee64b85e5c39407 /sys/net/bpf.h
parentAdd a smarter test that opens a file, unlinks it, and remounts the (diff)
downloadwireguard-openbsd-a60ac7a2fecea630cbc892141464020956782816.tar.xz
wireguard-openbsd-a60ac7a2fecea630cbc892141464020956782816.zip
add support for bpf on "subsystems", not just network interfaces
bpf assumed that it was being unconditionally attached to network interfaces, and maintained a pointer to a struct ifnet *. this was mostly used to get at the name of the interface, which is how userland asks to be attached to a particular interface. this diff adds a pointer to the name and uses it instead of the interface pointer for these lookups. this in turn allows bpf to be attached to arbitrary subsystems in the kernel which just have to supply a name rather than an interface pointer. for example, bpf could be attached to pf_test so you can see what packets are about to be filtered. mpi@ is using this to look at usb transfers. bpf still uses the interface pointer for bpfwrite, and for enabling and disabling promisc. however, these are nopped out for subsystems. ok mpi@
Diffstat (limited to 'sys/net/bpf.h')
-rw-r--r--sys/net/bpf.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 1583d44abcf..98afe4f4f60 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.h,v 1.62 2017/02/22 09:56:03 reyk Exp $ */
+/* $OpenBSD: bpf.h,v 1.63 2018/01/24 00:25:17 dlg Exp $ */
/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */
/*
@@ -313,6 +313,8 @@ int bpf_mtap_af(caddr_t, u_int32_t, const struct mbuf *, u_int);
int bpf_mtap_ether(caddr_t, const struct mbuf *, u_int);
void bpfattach(caddr_t *, struct ifnet *, u_int, u_int);
void bpfdetach(struct ifnet *);
+void *bpfsattach(caddr_t *, const char *, u_int, u_int);
+void bpfsdetach(void *);
void bpfilterattach(int);
u_int bpf_mfilter(const struct bpf_insn *, const struct mbuf *, u_int);