summaryrefslogtreecommitdiff
path: root/share/man/man9/bpf_mtap.9
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2018-01-12 02:19:48 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2018-01-12 02:19:48 +0000
commite43a0c70800a7c878edc13a8b8da60ae312a2d89 (patch)
treeac96c59fb22633f8b6a10667ef681163ca4e9b71 /share/man/man9/bpf_mtap.9
parent21669aa4f82e48d7826459106c0c122b513ac8b1 (diff)
document bpfattach and bpfdetach.
Diffstat (limited to 'share/man/man9/bpf_mtap.9')
-rw-r--r--share/man/man9/bpf_mtap.938
1 files changed, 36 insertions, 2 deletions
diff --git a/share/man/man9/bpf_mtap.9 b/share/man/man9/bpf_mtap.9
index 46e309ead68..d5b11fafa3e 100644
--- a/share/man/man9/bpf_mtap.9
+++ b/share/man/man9/bpf_mtap.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bpf_mtap.9,v 1.10 2016/10/10 08:33:32 bluhm Exp $
+.\" $OpenBSD: bpf_mtap.9,v 1.11 2018/01/12 02:19:47 dlg Exp $
.\"
.\" Copyright (c) 2016 David Gwynne <dlg@openbsd.org>
.\"
@@ -14,10 +14,12 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 10 2016 $
+.Dd $Mdocdate: January 12 2018 $
.Dt BPF_MTAP 9
.Os
.Sh NAME
+.Nm bpfattach ,
+.Nm bpfdetach ,
.Nm bpf_filter ,
.Nm bpf_mfilter ,
.Nm bpf_validate ,
@@ -28,6 +30,15 @@
.Nd BPF kernel API
.Sh SYNOPSIS
.In net/bpf.h
+.Ft void
+.Fo bpfattach
+.Fa "caddr_t *bpfp"
+.Fa "struct ifnet *ifp"
+.Fa "u_int dlt"
+.Fa "u_int hdrlen"
+.Fc
+.Ft void
+.Fn bpfdetach "struct ifnet *ifp"
.Ft u_int
.Fo bpf_filter
.Fa "const struct bpf_insn *pc"
@@ -69,6 +80,29 @@ against packets, and incoming linkage from device drivers.
A packet is parsed by the filters associated with each interface
and, if accepted, stashed into the corresponding buffer.
.Pp
+.Fn bpfattach
+allocates and configures a BPF interface for use with the network interface
+.Fa ifp .
+.Fa bpfp
+is the location of BPF interface pointer that the network interface passes to
+the filter functions.
+The BPF interface pointer will be clear until a filter is registered and
+packets can be filtered on it.
+The
+.Fa dlt
+argument identifies the data link-layer type that the network
+interface provides for this BPF interface.
+.Fn bpfattach
+may be called multiple times against the same network interface to
+provide different data link-layer types for filtering.
+.Fa hdrlen
+indicates the length of the link header for the data link-layer type.
+.Pp
+.Fn bpfdetach
+removes and frees all the BPF interfaces that were configured for
+the network interface
+.Fa ifp .
+.Pp
.Fn bpf_filter
executes the BPF program referenced by
.Fa pc