summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-01-29 13:26:14 +0000
committerpeter <peter@FreeBSD.org>2001-01-29 13:26:14 +0000
commit45d023e517fe74bc20d44c77e4612f3b5cf616ad (patch)
treed7ccee522152338ce8cc4dbcea7e04d873fa15a6 /sys/net/bpf.c
parent695e2716fdfbb7a4b3c7a07c6660c4f562fc1864 (diff)
downloadFreeBSD-src-45d023e517fe74bc20d44c77e4612f3b5cf616ad.zip
FreeBSD-src-45d023e517fe74bc20d44c77e4612f3b5cf616ad.tar.gz
Supply a stub bpf_validate() (always returning false - the script is not
valid) if BPF is missing. The netgraph_bpf node forced bpf to be present, reflect that in the options. Stop doing a 'count bpf' - we provide stubs. Since a handful of drivers still refer to "bpf.h", provide a more accurate indication that the API is present always. (eg: netinet6)
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 6487a82..23956f7 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -40,7 +40,8 @@
* $FreeBSD$
*/
-#include "bpf.h"
+#include "opt_bpf.h"
+#include "opt_netgraph.h"
#ifndef __GNUC__
#define inline
@@ -80,7 +81,7 @@
static MALLOC_DEFINE(M_BPF, "BPF", "BPF data");
-#if NBPF > 0
+#if defined(DEV_BPF) || defined(NETGRAPH_BPF)
/*
* Older BSDs don't have kernel malloc.
@@ -1396,7 +1397,7 @@ bpf_drvinit(unused)
SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL)
-#else /* !BPF */
+#else /* !DEV_BPF && !NETGRAPH_BPF */
/*
* NOP stubs to allow bpf-using drivers to load and function.
*
@@ -1442,4 +1443,12 @@ bpf_filter(pc, p, wirelen, buflen)
return -1; /* "no filter" behaviour */
}
-#endif /* !BPF */
+int
+bpf_validate(f, len)
+ const struct bpf_insn *f;
+ int len;
+{
+ return 0; /* false */
+}
+
+#endif /* !DEV_BPF && !NETGRAPH_BPF */
OpenPOWER on IntegriCloud