From ae853b3a1196502c15e20f1ae8a138a8b83c9597 Mon Sep 17 00:00:00 2001 From: msmith Date: Wed, 28 Apr 1999 01:18:13 +0000 Subject: Allow loadable interface drivers with BPF support to be loaded into a kernel that doesn't have it. This is achieved by having minimal do-nothing stubs enabled when there are no bpfilter devices configured. Driver modules should be built with BPF enabled for maximum convenience (but can be built without it for maximum performance). --- sys/net/bpf.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'sys/net/bpf.c') diff --git a/sys/net/bpf.c b/sys/net/bpf.c index a49ac6d..0c37a7a 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -37,13 +37,11 @@ * * @(#)bpf.c 8.2 (Berkeley) 3/28/94 * - * $Id: bpf.c,v 1.46 1998/12/07 21:58:36 archie Exp $ + * $Id: bpf.c,v 1.47 1999/01/27 22:42:13 dillon Exp $ */ #include "bpfilter.h" -#if NBPFILTER > 0 - #ifndef __GNUC__ #define inline #else @@ -86,6 +84,7 @@ #include #endif /*DEVFS*/ +#if NBPFILTER > 0 /* * Older BSDs don't have kernel malloc. @@ -1309,4 +1308,44 @@ bpf_drvinit(unused) SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) +#else /* !BPFILTER */ +/* + * NOP stubs to allow bpf-using drivers to load and function. + * + * A 'better' implementation would allow the core bpf functionality + * to be loaded at runtime. + */ + +void +bpf_tap(ifp, pkt, pktlen) + struct ifnet *ifp; + register u_char *pkt; + register u_int pktlen; +{ +} + +void +bpf_mtap(ifp, m) + struct ifnet *ifp; + struct mbuf *m; +{ +} + +void +bpfattach(ifp, dlt, hdrlen) + struct ifnet *ifp; + u_int dlt, hdrlen; +{ +} + +u_int +bpf_filter(pc, p, wirelen, buflen) + register struct bpf_insn *pc; + register u_char *p; + u_int wirelen; + register u_int buflen; +{ + return -1; /* "no filter" behaviour */ +} + #endif -- cgit v1.1