From a340aa6ca6cd08ae173fbb95cd3e65807264df07 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 15 Feb 2018 17:22:16 +0100 Subject: src: bail out when exporting ruleset with unsupported output Display error message and propagate error to shell when running command with unsupported output: # nft export ruleset json Error: this output type is not supported export ruleset json ^^^^^^^^^^^^^^^^^^^^ # echo $? 1 When displaying the output in json using the low-level VM representation, it shows: # nft export ruleset vm json ... low-level VM json output # echo $? 0 While at it, do the same with obsoleted XML output. Fixes: https://bugzilla.netfilter.org/show_bug.cgi?id=1224 Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/nftables.h b/include/nftables.h index 3bfa33e5..5e637e10 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -127,4 +127,6 @@ int nft_print(struct output_ctx *octx, const char *fmt, ...) int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...) __attribute__((format(printf, 2, 0))); +#define __NFT_OUTPUT_NOTSUPP UINT_MAX + #endif /* NFTABLES_NFTABLES_H */ -- cgit v1.2.3