summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-04-28 01:18:13 +0000
committermsmith <msmith@FreeBSD.org>1999-04-28 01:18:13 +0000
commitae853b3a1196502c15e20f1ae8a138a8b83c9597 (patch)
tree593463288461208718df12bd92fea82449507a1e /sys/net
parentaf7e9be5cce9a2ceb819f00b3f58014d23ab57cd (diff)
downloadFreeBSD-src-ae853b3a1196502c15e20f1ae8a138a8b83c9597.zip
FreeBSD-src-ae853b3a1196502c15e20f1ae8a138a8b83c9597.tar.gz
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).
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c45
1 files changed, 42 insertions, 3 deletions
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 <sys/devfsext.h>
#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
OpenPOWER on IntegriCloud