Deleted Added
sdiff udiff text old ( 68876 ) new ( 69922 )
full compact
1
2/*
3 * ng_bpf.c
4 *
5 * Copyright (c) 1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_bpf.c 68876 2000-11-18 15:17:43Z dwmalone $
40 * $Whistle: ng_bpf.c,v 1.3 1999/12/03 20:30:23 archie Exp $
41 */
42
43/*
44 * BPF NETGRAPH NODE TYPE
45 *
46 * This node type accepts any number of hook connections. With each hook
47 * is associated a bpf(4) filter program, and two hook names (each possibly

--- 143 unchanged lines hidden (view full) ---

191 NULL,
192 ng_bpf_constructor,
193 ng_bpf_rcvmsg,
194 ng_bpf_rmnode,
195 ng_bpf_newhook,
196 NULL,
197 NULL,
198 ng_bpf_rcvdata,
199 ng_bpf_rcvdata,
200 ng_bpf_disconnect,
201 ng_bpf_cmdlist
202};
203NETGRAPH_INIT(bpf, &typestruct);
204
205/* Default BPF program for a hook that matches nothing */
206static const struct ng_bpf_hookprog ng_bpf_default_prog = {
207 { '\0' }, /* to be filled in at hook creation time */

--- 162 unchanged lines hidden (view full) ---

370
371/*
372 * Receive data on a hook
373 *
374 * Apply the filter, and then drop or forward packet as appropriate.
375 */
376static int
377ng_bpf_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
378 struct mbuf **ret_m, meta_p *ret_meta)
379{
380 const hinfo_p hip = hook->private;
381 int totlen = m->m_pkthdr.len;
382 int needfree = 0, error = 0;
383 u_char *data, buf[256];
384 hinfo_p dhip;
385 hook_p dest;
386 u_int len;

--- 116 unchanged lines hidden ---