summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2006-02-05 17:17:32 +0000
committermlaier <mlaier@FreeBSD.org>2006-02-05 17:17:32 +0000
commit0c9bbeed735fcdda1e73ad11a546291ac7cd0f38 (patch)
treecf3414ab53bdaf9af21aec5a91239ee25bae23d9
parentd249843f8b66ce93c375000e8028521cb8c813fb (diff)
downloadFreeBSD-src-0c9bbeed735fcdda1e73ad11a546291ac7cd0f38.zip
FreeBSD-src-0c9bbeed735fcdda1e73ad11a546291ac7cd0f38.tar.gz
Make pflog a seperate module. As a result pflog_packet() becomes a function
pointer that is declared in pf_ioctl.c Requested by: yar (as part of the module build reorg) MFC after: 1 week X-MFC with: yar's module reorg
-rw-r--r--sys/contrib/pf/net/if_pflog.c7
-rw-r--r--sys/contrib/pf/net/if_pflog.h14
-rw-r--r--sys/contrib/pf/net/pf_ioctl.c5
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/pf/Makefile3
-rw-r--r--sys/modules/pflog/Makefile27
6 files changed, 55 insertions, 3 deletions
diff --git a/sys/contrib/pf/net/if_pflog.c b/sys/contrib/pf/net/if_pflog.c
index 671ea26..54f7129 100644
--- a/sys/contrib/pf/net/if_pflog.c
+++ b/sys/contrib/pf/net/if_pflog.c
@@ -376,9 +376,15 @@ pflog_modevent(module_t mod, int type, void *data)
case MOD_LOAD:
LIST_INIT(&pflog_list);
if_clone_attach(&pflog_cloner);
+ PF_LOCK();
+ pflog_packet_ptr = pflog_packet;
+ PF_UNLOCK();
break;
case MOD_UNLOAD:
+ PF_LOCK();
+ pflog_packet_ptr = NULL;
+ PF_UNLOCK();
if_clone_detach(&pflog_cloner);
break;
@@ -400,4 +406,5 @@ static moduledata_t pflog_mod = {
DECLARE_MODULE(pflog, pflog_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY);
MODULE_VERSION(pflog, PFLOG_MODVER);
+MODULE_DEPEND(pflog, pf, PF_MODVER, PF_MODVER, PF_MODVER);
#endif /* __FreeBSD__ */
diff --git a/sys/contrib/pf/net/if_pflog.h b/sys/contrib/pf/net/if_pflog.h
index 68560e4..93cb884 100644
--- a/sys/contrib/pf/net/if_pflog.h
+++ b/sys/contrib/pf/net/if_pflog.h
@@ -70,10 +70,24 @@ struct old_pfloghdr {
#ifdef _KERNEL
+#ifdef __FreeBSD__
+/* XXX */
+#include <net/pfvar.h>
+
+typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t,
+ u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *,
+ struct pf_ruleset *);
+extern pflog_packet_t *pflog_packet_ptr;
+#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g) do { \
+ if (pflog_packet_ptr != NULL) \
+ pflog_packet_ptr(i,a,b,c,d,e,f,g); \
+} while (0)
+#else
#if NPFLOG > 0
#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g) pflog_packet(i,a,b,c,d,e,f,g)
#else
#define PFLOG_PACKET(i,x,a,b,c,d,e,f,g) ((void)0)
#endif /* NPFLOG > 0 */
+#endif /* __FreeBSD__ */
#endif /* _KERNEL */
#endif /* _NET_IF_PFLOG_H_ */
diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c
index 1141b2f..fdc3b18 100644
--- a/sys/contrib/pf/net/pf_ioctl.c
+++ b/sys/contrib/pf/net/pf_ioctl.c
@@ -108,6 +108,10 @@
#include <net/if_pfsync.h>
#endif /* NPFSYNC > 0 */
+#ifdef __FreeBSD__
+#include <net/if_pflog.h>
+#endif
+
#ifdef INET6
#include <netinet/ip6.h>
#include <netinet/in_pcb.h>
@@ -230,6 +234,7 @@ static struct cdevsw pf_cdevsw = {
static volatile int pf_pfil_hooked = 0;
struct mtx pf_task_mtx;
+pflog_packet_t *pflog_packet_ptr = NULL;
void
init_pf_mutex(void)
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index db3d879..f8cc7c0 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -180,6 +180,7 @@ SUBDIR= ${_3dfx} \
pcn \
${_pecoff} \
${_pf} \
+ ${_pflog} \
plip \
${_pmc} \
portalfs \
@@ -307,6 +308,7 @@ _ipfilter= ipfilter
.if !defined(NO_PF) || defined(ALL_MODULES)
_pf= pf
+_pflog= pflog
.endif
.if ${MACHINE_ARCH} == "i386"
diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile
index 9a73c41..bcdbb96 100644
--- a/sys/modules/pf/Makefile
+++ b/sys/modules/pf/Makefile
@@ -2,11 +2,9 @@
.PATH: ${.CURDIR}/../../contrib/pf/net
.PATH: ${.CURDIR}/../../contrib/pf/netinet
-.PATH: ${.CURDIR}/../../netinet
KMOD= pf
SRCS = pf.c pf_if.c pf_subr.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \
- if_pflog.c \
in4_cksum.c \
opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h
@@ -15,7 +13,6 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf
.if !defined(KERNBUILDDIR)
opt_pf.h:
echo "#define DEV_PF 1" > opt_pf.h
- echo "#define DEV_PFLOG 1" >> opt_pf.h
opt_inet.h:
echo "#define INET 1" > opt_inet.h
diff --git a/sys/modules/pflog/Makefile b/sys/modules/pflog/Makefile
new file mode 100644
index 0000000..a2ce411
--- /dev/null
+++ b/sys/modules/pflog/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../contrib/pf/net
+
+KMOD= pflog
+SRCS = if_pflog.c \
+ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h
+
+CFLAGS+= -I${.CURDIR}/../../contrib/pf
+
+.if !defined(KERNBUILDDIR)
+opt_pf.h:
+ echo "#define DEV_PFLOG 1" > opt_pf.h
+
+opt_inet.h:
+ echo "#define INET 1" > opt_inet.h
+
+.if !defined(NO_INET6)
+opt_inet6.h:
+ echo "#define INET6 1" > opt_inet6.h
+.endif
+
+opt_bpf.h:
+ echo "#define DEV_BPF 1" > opt_bpf.h
+.endif
+
+.include <bsd.kmod.mk>
OpenPOWER on IntegriCloud