summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-10-21 16:20:10 +0200
committerPhil Sutter <phil@nwl.cc>2019-10-21 18:21:08 +0200
commit00487d5fe3ece179e61124ee62449f4ad7d1918e (patch)
treebcdc8577fd20b35aeead5a805a35b1703614c79b
parent8ecb8855895915513e757ffc8d3b7342e63e9fe6 (diff)
parser_json: Fix checking of parse_policy() return code
The function was changed to return an expression or NULL but error checking wasn't adjusted while doing so. Fixes: dba4a9b4b5fe2 ("src: allow variable in chain policy") Signed-off-by: Phil Sutter <phil@nwl.cc> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/parser_json.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser_json.c b/src/parser_json.c
index 55dbc177..fe0c5df9 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -2630,7 +2630,7 @@ static struct cmd *json_parse_cmd_add_chain(struct json_ctx *ctx, json_t *root,
chain->dev = xstrdup(chain->dev);
if (!json_unpack(root, "{s:s}", "policy", &policy)) {
chain->policy = parse_policy(policy);
- if (chain->policy < 0) {
+ if (!chain->policy) {
json_error(ctx, "Unknown policy '%s'.", policy);
chain_free(chain);
return NULL;