1 From 653db8b938166db7833135f615b90c38a3f27a30 Mon Sep 17 00:00:00 2001
2 From: "Maxin B. John" <maxin.john@intel.com>
3 Date: Thu, 25 Apr 2024 10:51:02 +0200
4 Subject: [PATCH] configure: Add option to enable/disable libnfnetlink
6 Default behavior (autodetecting) does not change, but specifying
7 either option would explicitly disable or enable libnfnetlink support,
8 and if the library is not found in the latter case, ./configure will error
11 Upstream-Status: Backport [https://git.netfilter.org/iptables/commit/?id=653db8b938166db7833135f615b90c38a3f27a30]
12 Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 Signed-off-by: Maxin B. John <maxin.john@intel.com>
14 Signed-off-by: Alexander Kanavin <alex@linutronix.de>
15 Signed-off-by: Phil Sutter <phil@nwl.cc>
17 configure.ac | 13 +++++++++++--
18 1 file changed, 11 insertions(+), 2 deletions(-)
20 diff --git a/configure.ac b/configure.ac
21 index d99fa3b9..2293702b 100644
24 @@ -63,6 +63,9 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
25 AC_ARG_ENABLE([nftables],
26 AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]),
27 [enable_nftables="$enableval"], [enable_nftables="yes"])
28 +AC_ARG_ENABLE([libnfnetlink],
29 + AS_HELP_STRING([--disable-libnfnetlink], [Do not use netfilter netlink library]),
30 + [enable_libnfnetlink="$enableval"], [enable_libnfnetlink="auto"])
31 AC_ARG_ENABLE([connlabel],
32 AS_HELP_STRING([--disable-connlabel],
33 [Do not build libnetfilter_conntrack]),
34 @@ -113,8 +116,14 @@ AM_CONDITIONAL([ENABLE_SYNCONF], [test "$enable_nfsynproxy" = "yes"])
35 AM_CONDITIONAL([ENABLE_NFTABLES], [test "$enable_nftables" = "yes"])
36 AM_CONDITIONAL([ENABLE_CONNLABEL], [test "$enable_connlabel" = "yes"])
38 -PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
39 - [nfnetlink=1], [nfnetlink=0])
40 +# If specified explicitly on the command line, error out when library was not found
41 +# Otherwise, disable and continue
42 +AS_IF([test "x$enable_libnfnetlink" = "xyes"],
43 + [PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
45 + [test "x$enable_libnfnetlink" = "xauto"],
46 + [PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
47 + [nfnetlink=1], [nfnetlink=0])])
48 AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
50 if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then