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).
This commit is contained in:
parent
5206bca10a
commit
f8dc47162a
@ -387,7 +387,7 @@ ntfs/ntfs_vnops.c optional ntfs
|
||||
ntfs/ntfs_subr.c optional ntfs
|
||||
ntfs/ntfs_compr.c optional ntfs
|
||||
ntfs/ntfs_ihash.c optional ntfs
|
||||
net/bpf.c optional bpfilter
|
||||
net/bpf.c standard
|
||||
net/bpf_filter.c optional bpfilter
|
||||
net/bridge.c optional bridge
|
||||
net/bsd_comp.c optional ppp_bsdcomp
|
||||
|
@ -1,11 +1,11 @@
|
||||
# $Id: Makefile,v 1.5 1998/02/01 18:12:13 bde Exp $
|
||||
# $Id: Makefile,v 1.6 1998/10/16 04:30:44 peter Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/../../net
|
||||
KMOD= if_disc
|
||||
SRCS= if_disc.c bpfilter.h opt_inet.h
|
||||
NOMAN=
|
||||
|
||||
NBPFILTER?= 0
|
||||
NBPFILTER?= 1
|
||||
|
||||
CFLAGS+= ${PROTOS}
|
||||
CLEANFILES+= bpfilter.h opt_inet.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.15 1998/10/16 04:30:44 peter Exp $
|
||||
# $Id: Makefile,v 1.16 1999/01/17 20:53:48 peter Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/../../net
|
||||
KMOD= if_ppp
|
||||
@ -10,7 +10,7 @@ CLEANFILES+= vnode_if.c vnode_if.h
|
||||
NPPP?= 2
|
||||
PPP_BSDCOMP?= 1 # 0/1
|
||||
PPP_DEFLATE?= 1 # 0/1
|
||||
PPP_FILTER?= 0 # 0/1 - requires bpf to be configured in kernel
|
||||
PPP_FILTER?= 1 # 0/1 - requires bpf to be configured in kernel
|
||||
PPP_INET?= 1 # 0/1 - requires INET to be configured in kernel
|
||||
PPP_IPX?= 0 # 0/1 - requires IPX to be configured in kernel
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
# $Id: Makefile,v 1.6 1998/02/01 18:12:14 bde Exp $
|
||||
# $Id: Makefile,v 1.7 1998/10/16 04:30:45 peter Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/../../net
|
||||
KMOD= if_sl
|
||||
SRCS= if_sl.c slcompress.c bpfilter.h opt_inet.h sl.h
|
||||
NOMAN=
|
||||
|
||||
NBPFILTER?= 0
|
||||
NBPFILTER?= 1
|
||||
NSL?= 2
|
||||
PROTOS?= -DINET
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.7 1998/10/16 04:30:45 peter Exp $
|
||||
# $Id: Makefile,v 1.8 1999/01/17 20:53:47 peter Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/../../net
|
||||
KMOD= if_tun
|
||||
@ -6,7 +6,7 @@ SRCS= if_tun.c bpfilter.h opt_devfs.h opt_inet.h tun.h vnode_if.h
|
||||
NOMAN=
|
||||
CLEANFILES+= vnode_if.h vnode_if.c
|
||||
|
||||
NBPFILTER?= 0
|
||||
NBPFILTER?= 1
|
||||
NTUN?= 2
|
||||
|
||||
CFLAGS+= ${PROTOS}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user