1.\" $NetBSD: bpf.9,v 1.5 2018/06/25 10:53:47 wiz Exp $ 2.\" 3.\" Copyright (c) 2010 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd June 25, 2018 28.Dt BPF 9 29.Os 30.Sh NAME 31.Nm bpf 32.Nd Berkeley Packet Filter kernel interface 33.Sh SYNOPSIS 34.In sys/mbuf.h 35.In net/bpf.h 36.Sh DESCRIPTION 37.Nm 38is called via an operations vector described by the following struct: 39.Bd -literal 40struct bpf_ops { 41 void (*bpf_attach)(struct ifnet *, u_int, u_int, struct bpf_if **); 42 void (*bpf_detach)(struct ifnet *); 43 void (*bpf_change_type)(struct ifnet *, u_int, u_int); 44 45 void (*bpf_mtap)(struct bpf_if *, struct mbuf *); 46 void (*bpf_mtap2)(struct bpf_if *, void *, u_int, struct mbuf *); 47 void (*bpf_mtap_af)(struct bpf_if *, uint32_t, struct mbuf *); 48 void (*bpf_mtap_et)(struct bpf_if *, uint16_t, struct mbuf *); 49 void (*bpf_mtap_sl_in)(struct bpf_if *, u_char *, struct mbuf **); 50 void (*bpf_mtap_sl_out)(struct bpf_if *, u_char *, struct mbuf *); 51}; 52.Ed 53.Pp 54This vector is found from 55.Vt struct bpf_ops * 56.Va bpf_ops . 57It is either a 58.Dq stub 59implementation or a real implementation, depending on whether 60.Nm 61is absent or present in the kernel, respectively. 62.Sh CODE REFERENCES 63The 64.Nm 65implementation is located in 66.Pa sys/net/bpf.c , 67the stub implementation is in 68.Pa sys/net/bpf_stub.c , 69and 70.Pa sys/net/bpf.h 71describes the interface. 72