1.\" $NetBSD: bpf.9,v 1.3 2010/12/02 12:54:13 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 8, 2010 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.Pp 40.Bd -literal 41struct bpf_ops { 42 void (*bpf_attach)(struct ifnet *, u_int, u_int, struct bpf_if **); 43 void (*bpf_detach)(struct ifnet *); 44 void (*bpf_change_type)(struct ifnet *, u_int, u_int); 45 46 void (*bpf_tap)(struct bpf_if *, u_char *, u_int); 47 void (*bpf_mtap)(struct bpf_if *, struct mbuf *); 48 void (*bpf_mtap2)(struct bpf_if *, void *, u_int, struct mbuf *); 49 void (*bpf_mtap_af)(struct bpf_if *, uint32_t, struct mbuf *); 50 void (*bpf_mtap_et)(struct bpf_if *, uint16_t, struct mbuf *); 51 void (*bpf_mtap_sl_in)(struct bpf_if *, u_char *, struct mbuf **); 52 void (*bpf_mtap_sl_out)(struct bpf_if *, u_char *, struct mbuf *); 53}; 54.Ed 55.Pp 56This vector is found from 57.Vt struct bpf_ops * 58.Va bpf_ops . 59It is either a 60.Dq stub 61implementation or a real implementation, depending on whether 62.Nm 63is absent or present in the kernel, respectively. 64.Sh CODE REFERENCES 65The 66.Nm 67implementation is located in 68.Pa sys/net/bpf.c , 69the stub implementation is in 70.Pa sys/net/bpf_stub.c , 71and 72.Pa sys/net/bpf.h 73describes the interface. 74