From e70354f53e9f6be4a4be31dbc46c5e23291d3587 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 8 May 2018 13:08:37 +0200 Subject: libnftables: Implement JSON output support Although technically there already is support for JSON output via 'nft export json' command, it is hardly useable since it exports all the gory details of nftables VM. Also, libnftables has no control over what is exported since the content comes directly from libnftnl. Instead, implement JSON format support for regular 'nft list' commands. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- configure.ac | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index eb5649dd..36148aea 100644 --- a/configure.ac +++ b/configure.ac @@ -107,6 +107,17 @@ AC_DEFINE([HAVE_LIBXTABLES], [1], [0]) AC_SUBST(with_libxtables) AM_CONDITIONAL([BUILD_XTABLES], [test "x$with_libxtables" == xyes]) +AC_ARG_WITH([json], [AS_HELP_STRING([--with-json], + [Enable JSON output support)])], + [], [with_json=no]) +AS_IF([test "x$with_json" != xno], [ +AC_CHECK_LIB([jansson], [json_object], , + AC_MSG_ERROR([No suitable version of libjansson found])) +AC_DEFINE([HAVE_LIBJANSSON], [1], [Define if you have libjansson]) +]) +AC_SUBST(with_json) +AM_CONDITIONAL([BUILD_JSON], [test "x$with_json" != xno]) + AC_CONFIG_FILES([ \ Makefile \ libnftables.pc \ @@ -132,4 +143,5 @@ nft configuration: use mini-gmp: ${with_mini_gmp} enable man page: ${enable_man_doc} enable pdf documentation: ${enable_pdf_doc} - libxtables support: ${with_libxtables}" + libxtables support: ${with_libxtables} + json output support: ${with_json}" -- cgit v1.2.3