]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: bail out when exporting ruleset with unsupported output
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 15 Feb 2018 16:22:16 +0000 (17:22 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 15 Feb 2018 17:39:09 +0000 (18:39 +0100)
commita340aa6ca6cd08ae173fbb95cd3e65807264df07
treee763cfd5e5fe1d0f952fefc7c91e318be0fb8353
parentd9428e67fca288e4f34dbb6c0dfe42ebc48c9ad1
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 <pablo@netfilter.org>
include/nftables.h
src/evaluate.c
src/parser_bison.y