See whether we should compile ipfilter with INET6 support by looking at the
authorPeter Avalos <pavalos@dragonflybsd.org>
Mon, 18 Dec 2006 23:26:36 +0000 (23:26 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Mon, 18 Dec 2006 23:26:36 +0000 (23:26 +0000)
kernel config rather than requiring the user to use an undocumented build
option.

Thanks to corecode, TGEN, and vbd for various suggestions and Max Herrgard
<herrgard@gmail.com> for testing.

Dragonfly-bug:  <http://bugs.dragonflybsd.org/issue322>
Reviewed-by: vbd
sys/net/ipfilter/Makefile
sys/net/ipfilter/ipf_inet6.h [new file with mode: 0644]

index 4771364..3f806bc 100644 (file)
@@ -1,16 +1,23 @@
 # $FreeBSD: src/sys/modules/ipfilter/Makefile,v 1.2.2.2 2001/06/07 05:11:44 jlemon Exp $ 
-# $DragonFly: src/sys/net/ipfilter/Makefile,v 1.3 2004/07/28 00:22:37 hmp Exp $ 
+# $DragonFly: src/sys/net/ipfilter/Makefile,v 1.4 2006/12/18 23:26:36 pavalos Exp $ 
 
 .PATH: ${.CURDIR}/../../contrib/ipfilter/netinet
 KMOD=  ipl
 SRCS=  mlfk_ipl.c ip_nat.c ip_frag.c ip_state.c ip_proxy.c ip_auth.c \
-       ip_log.c ip_fil.c fil.c
+       ip_log.c ip_fil.c fil.c opt_inet6.h
 NOMAN=
-.if !defined(NOINET6)
-CFLAGS+= -DUSE_INET6
+
+# XXX:  Building this outside of a buildkernel with a kernel that does not have
+# INET6 is not supported since the module will complain about undefined symbols
+# when loaded.
+.if !defined(BUILDING_WITH_KERNEL)
+opt_inet6.h:
+       ${ECHO} "#define INET6   1" > ${.TARGET}
 .endif
+
+CFLAGS+= -include ipf_inet6.h
 CFLAGS+= -DIPFILTER_LKM -DIPFILTER_LOG
-CFLAGS+=  -I${.CURDIR}/../../contrib/ipfilter
+CFLAGS+= -I${.CURDIR}/../../contrib/ipfilter -I${.CURDIR}
 #
 # If you don't want log functionality remove -DIPFILTER_LOG
 #
diff --git a/sys/net/ipfilter/ipf_inet6.h b/sys/net/ipfilter/ipf_inet6.h
new file mode 100644 (file)
index 0000000..53fecc1
--- /dev/null
@@ -0,0 +1,8 @@
+/* $DragonFly: src/sys/net/ipfilter/ipf_inet6.h,v 1.1 2006/12/18 23:26:36 pavalos Exp $ */
+/* This file uses the kernel config to determine if IPV6 should be used. */
+
+#include "opt_inet6.h"
+
+#ifdef INET6
+#define USE_INET6      1
+#endif