]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
xt: fix build when libxtables is not installed
authorFlorian Westphal <fw@strlen.de>
Thu, 29 Nov 2018 13:57:59 +0000 (14:57 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 4 Dec 2018 00:39:36 +0000 (01:39 +0100)
If libxtables is not even installed, build fails due to to missing
include file.

ifdef LIBXTABLES guard fixes the first error, but results in two
followup failures:
1. missing IFNAMSIZ definition
2. dereference of unknown struct.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/xt.c

index ab7f50173149124eee5e67a8a0394a15436b6893..08560976aa0f2eea882a96abc7681fc94479ff41 100644 (file)
--- a/src/xt.c
+++ b/src/xt.c
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
+#include <net/if.h>
+#ifdef HAVE_LIBXTABLES
 #include <xtables.h>
+#endif
 #include <getopt.h>
 #include <ctype.h>     /* for isspace */
 #include <statement.h>
@@ -76,6 +79,7 @@ void xt_stmt_xlate(const struct stmt *stmt, struct output_ctx *octx)
 
 void xt_stmt_release(const struct stmt *stmt)
 {
+#ifdef HAVE_LIBXTABLES
        switch (stmt->xt.type) {
        case NFT_XT_MATCH:
                if (!stmt->xt.match)
@@ -95,6 +99,7 @@ void xt_stmt_release(const struct stmt *stmt)
        default:
                break;
        }
+#endif
        xfree(stmt->xt.entry);
 }