[nft PATCH] nft: Reject 'export vm json' command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since libnftnl recently dropped JSON output support, this form of JSON
export is not available anymore. Point at 'nft -j list ruleset' command
in error message and enhance man page a bit.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 doc/nft.txt    | 8 ++++++--
 src/evaluate.c | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/nft.txt b/doc/nft.txt
index 45af5bb9e7e51..b54623fb95a00 100644
--- a/doc/nft.txt
+++ b/doc/nft.txt
@@ -9,7 +9,7 @@ nft - Administration tool of the nftables framework for packet filtering and cla
 SYNOPSIS
 --------
 [verse]
-*nft* [ *-nNscaeSupy* ] [ *-I* 'directory' ] [ *-f* 'filename' | *-i* | 'cmd' ...]
+*nft* [ *-nNscaeSupyj* ] [ *-I* 'directory' ] [ *-f* 'filename' | *-i* | 'cmd' ...]
 *nft* *-h*
 *nft* *-v*
 
@@ -74,6 +74,10 @@ For a full summary of options, run *nft --help*.
 	When inserting items into the ruleset using *add*, *insert* or *replace* commands, print notifications
 	just like *nft monitor*.
 
+*-j*::
+*--json*::
+	Format output in JSON. See libnftables-json(5) for a schema description.
+
 *-I*::
 *--includepath directory*::
 	Add the directory 'directory' to the list of directories to be searched for included files. This
@@ -783,7 +787,7 @@ Netlink socket with 3.
 SEE ALSO
 --------
 [verse]
-iptables(8), ip6tables(8), arptables(8), ebtables(8), ip(8), tc(8)
+libnftables(3), libnftables-json(5), iptables(8), ip6tables(8), arptables(8), ebtables(8), ip(8), tc(8)
 
 There is an official wiki at: https://wiki.nftables.org
 
diff --git a/src/evaluate.c b/src/evaluate.c
index c0edf8f6e7702..fc0eabd0adad0 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3804,6 +3804,9 @@ static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
 	if (cmd->markup->format == __NFT_OUTPUT_NOTSUPP)
 		return cmd_error(ctx, &cmd->location,
 				 "this output type is not supported");
+	else if (cmd->markup->format == NFTNL_OUTPUT_JSON)
+		return cmd_error(ctx, &cmd->location,
+				 "JSON export is no longer supported, use 'nft -j list ruleset' instead");
 
 	return cache_update(ctx->nft, cmd->op, ctx->msgs);
 }
-- 
2.19.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux