From: Eric Leblond <eric@inl.fr>
To: netfilter-devel@vger.kernel.org
Cc: Eric Leblond <eric@inl.fr>
Subject: [PATCH 1/6] build: nfct and nflog can be disabled via configure option
Date: Wed, 22 Sep 2010 02:47:17 +0200 [thread overview]
Message-ID: <1285116442-32490-2-git-send-email-eric@inl.fr> (raw)
In-Reply-To: <1285116442-32490-1-git-send-email-eric@inl.fr>
This patch modifies the build system to be able to disable the compilation
of NFCT and NFLOG input plugin. They are dependant of external libraries
which can not be available on the system.
Default is to compile these input plugin which make compilation behaviour
conservative.
Signed-off-by: Eric Leblond <eric@inl.fr>
---
configure.ac | 19 ++++++++++++++++---
input/flow/Makefile.am | 2 ++
input/packet/Makefile.am | 5 +++++
output/ulogd_output_XML.c | 12 ++++++++++--
4 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index e5a64fe..af14f36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,11 +38,21 @@ LIBNFNETLINK_REQUIRED=0.0.39
LIBNETFILTER_CONNTRACK_REQUIRED=0.0.95
LIBNETFILTER_LOG_REQUIRED=1.0.0
-PKG_CHECK_MODULES(LIBNFNETLINK, libnfnetlink >= $LIBNFNETLINK_REQUIRED,, AC_MSG_ERROR(Cannot find libnfnetlink >= $LIBNFNETLINK_REQUIRED))
+AC_ARG_ENABLE(nfct, [AC_HELP_STRING(--disable-nfct, Do not build NFCT input plugin)],build_nfct=$enableval, build_nfct="yes")
+AC_ARG_ENABLE(nflog, [AC_HELP_STRING(--disable-nflog, Do not build NFLOG input plugin)],build_nflog=$enableval, build_nflog="yes")
+if test "${build_nfct}" = "yes" ||Â test "${build_nflog}" = "yes" ; then
+ PKG_CHECK_MODULES(LIBNFNETLINK, libnfnetlink >= $LIBNFNETLINK_REQUIRED,, AC_MSG_ERROR(Cannot find libnfnetlink >= $LIBNFNETLINK_REQUIRED))
+fi
-PKG_CHECK_MODULES(LIBNETFILTER_CONNTRACK, libnetfilter_conntrack >= $LIBNETFILTER_CONNTRACK_REQUIRED,, AC_MSG_ERROR(Cannot find libnetfilter_conntrack >= $LIBNETFILTER_CONNTRACK_REQUIRED))
+if test "${build_nfct}" = "yes"; then
+ PKG_CHECK_MODULES(LIBNETFILTER_CONNTRACK, libnetfilter_conntrack >= $LIBNETFILTER_CONNTRACK_REQUIRED,, AC_MSG_ERROR(Cannot find libnetfilter_conntrack >= $LIBNETFILTER_CONNTRACK_REQUIRED))
+ AC_DEFINE_UNQUOTED([HAVE_LIBNETFILTER_CONNTRACK],[1],[libnetfilter_conntrack is available])
+fi
-PKG_CHECK_MODULES(LIBNETFILTER_LOG, libnetfilter_log >= $LIBNETFILTER_LOG_REQUIRED,, AC_MSG_ERROR(Cannot find libnetfilter_log >= $LIBNETFILTER_LOG_REQUIRED))
+if test "${build_nflog}" = "yes"; then
+ PKG_CHECK_MODULES(LIBNETFILTER_LOG, libnetfilter_log >= $LIBNETFILTER_LOG_REQUIRED,, AC_MSG_ERROR(Cannot find libnetfilter_log >= $LIBNETFILTER_LOG_REQUIRED))
+ AC_DEFINE_UNQUOTED([HAVE_LIBNETFILTER_LOG],[1],[libnetfilter_log is available])
+fi
CT_CHECK_POSTGRES_DB()
@@ -60,6 +70,9 @@ AM_CONDITIONAL(HAVE_DBI, test "x$DBI_LIB" != "x")
CT_CHECK_PCAP()
AM_CONDITIONAL(HAVE_PCAP, test "x$PCAP_LIB" != "x")
+AM_CONDITIONAL(HAVE_NFCT, test "x$build_nfct" != "xno")
+AM_CONDITIONAL(HAVE_NFLOG, test "x$build_nflog" != "xno")
+
dnl AC_SUBST(DATABASE_DIR)
dnl AC_SUBST(DATABASE_LIB)
diff --git a/input/flow/Makefile.am b/input/flow/Makefile.am
index 11bf217..5d7bdc4 100644
--- a/input/flow/Makefile.am
+++ b/input/flow/Makefile.am
@@ -2,11 +2,13 @@
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-fPIC -Wall
+if HAVE_NFCT
pkglib_LTLIBRARIES = ulogd_inpflow_NFCT.la # ulogd_inpflow_IPFIX.la
ulogd_inpflow_NFCT_la_SOURCES = ulogd_inpflow_NFCT.c
ulogd_inpflow_NFCT_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_CONNTRACK_LIBS)
ulogd_inpflow_NFCT_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_CONNTRACK_CFLAGS)
+endif
#ulogd_inpflow_IPFIX_la_SOURCES = ulogd_inpflow_IPFIX.c
#ulogd_inpflow_IPFIX_la_LDFLAGS = -avoid-version -module
diff --git a/input/packet/Makefile.am b/input/packet/Makefile.am
index e90e46e..44b7442 100644
--- a/input/packet/Makefile.am
+++ b/input/packet/Makefile.am
@@ -3,12 +3,17 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-fPIC -Wall
LIBS=
+if HAVE_NFLOG
pkglib_LTLIBRARIES = ulogd_inppkt_NFLOG.la ulogd_inppkt_ULOG.la
ulogd_inppkt_NFLOG_la_SOURCES = ulogd_inppkt_NFLOG.c
ulogd_inppkt_NFLOG_la_LDFLAGS = -avoid-version -module $(LIBNETFILTER_LOG_LIBS)
ulogd_inppkt_NFLOG_la_CFLAGS = $(AM_CFLAGS) $(LIBNETFILTER_LOG_CFLAGS)
+else
+pkglib_LTLIBRARIES = ulogd_inppkt_ULOG.la
+endif
+
ulogd_inppkt_ULOG_la_SOURCES = ulogd_inppkt_ULOG.c
ulogd_inppkt_ULOG_la_LDFLAGS = -avoid-version -module
ulogd_inppkt_ULOG_la_LIBADD = ../../libipulog/libipulog.la
diff --git a/output/ulogd_output_XML.c b/output/ulogd_output_XML.c
index 1ec9d8c..55ccd5a 100644
--- a/output/ulogd_output_XML.c
+++ b/output/ulogd_output_XML.c
@@ -18,8 +18,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <config.h>
#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+#ifdef HAVE_LIBNETFILTER_LOG
#include <libnetfilter_log/libnetfilter_log.h>
+#endif
#include <ulogd/ulogd.h>
#include <sys/param.h>
#include <time.h>
@@ -95,6 +98,7 @@ xml_output_flow(struct ulogd_key *inp, char *buf, ssize_t size)
return 0;
}
+#ifdef HAVE_LIBNETFILTER_LOG
static int
xml_output_packet(struct ulogd_key *inp, char *buf, ssize_t size)
{
@@ -107,6 +111,7 @@ xml_output_packet(struct ulogd_key *inp, char *buf, ssize_t size)
return 0;
}
+#endif
static int xml_output(struct ulogd_pluginstance *upi)
{
@@ -117,8 +122,11 @@ static int xml_output(struct ulogd_pluginstance *upi)
if (pp_is_valid(inp, KEY_CT))
ret = xml_output_flow(inp, buf, sizeof(buf));
- else if (pp_is_valid(inp, KEY_PCKT))
- ret = xml_output_packet(inp, buf, sizeof(buf));
+ else
+#ifdef HAVE_LIBNETFILTER_LOG
+ if (pp_is_valid(inp, KEY_PCKT))
+ ret = xml_output_packet(inp, buf, sizeof(buf));
+#endif
if (ret < 0)
return ULOGD_IRET_ERR;
--
1.6.1
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-09-22 0:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 0:47 [ULOGD PATCH 0/6] misc improvements and code cleaning Eric Leblond
2010-09-22 0:47 ` Eric Leblond [this message]
2010-09-30 9:58 ` [PATCH 1/6] build: nfct and nflog can be disabled via configure option Pablo Neira Ayuso
2010-09-22 0:47 ` [PATCH 2/6] ulogd.conf: Comment library dependant plugins Eric Leblond
2010-09-30 9:51 ` Pablo Neira Ayuso
2010-09-30 21:23 ` Eric Leblond
2010-09-22 0:47 ` [PATCH 3/6] build: add debug configure flag Eric Leblond
2010-09-30 9:50 ` Pablo Neira Ayuso
2010-09-30 21:22 ` Eric Leblond
2010-10-01 22:22 ` Jan Engelhardt
2010-10-03 10:15 ` Pablo Neira Ayuso
2010-09-22 0:47 ` [PATCH 4/6] ulogd.conf: add a complex but useful stack example Eric Leblond
2010-09-22 0:47 ` [PATCH 5/6] filter_MARK: code factorization Eric Leblond
2010-09-22 0:47 ` [PATCH 6/6] ulogd: use snprintf instead of sprintf in printpkt Eric Leblond
2010-09-30 9:48 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285116442-32490-2-git-send-email-eric@inl.fr \
--to=eric@inl.fr \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).