From: Eric Garver <eric@garver.life>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Phil Sutter <phil@nwl.cc>, Stefano Brivio <sbrivio@redhat.com>
Subject: [PATCH 2/2] tests: shell: json parsing prefix inside concat
Date: Thu, 20 Feb 2020 12:12:42 -0500 [thread overview]
Message-ID: <20200220171242.15240-2-eric@garver.life> (raw)
In-Reply-To: <20200220171242.15240-1-eric@garver.life>
Signed-off-by: Eric Garver <eric@garver.life>
---
# ./run-tests.sh ./testcases/sets/0044json_prefix_in_concat_0
I: using nft binary ./../../src/nft
I: [OK] ./testcases/sets/0044json_prefix_in_concat_0
I: results: [OK] 1 [FAILED] 0 [TOTAL] 1
# NFT=/usr/sbin/nft ./run-tests.sh ./testcases/sets/0044json_prefix_in_concat_0
I: using nft binary /usr/sbin/nft
W: [FAILED] ./testcases/sets/0044json_prefix_in_concat_0: got
internal:0:0-0: Error: Expression type prefix not allowed in context (RHS, PRIMARY).
internal:0:0-0: Error: Parsing expr at index 0 failed.
internal:0:0-0: Error: Invalid set elem at index 0.
internal:0:0-0: Error: Invalid set.
internal:0:0-0: Error: Parsing command array at index 3 failed.
I: results: [OK] 0 [FAILED] 1 [TOTAL] 1
---
.../shell/testcases/sets/0044json_prefix_in_concat_0 | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100755 tests/shell/testcases/sets/0044json_prefix_in_concat_0
diff --git a/tests/shell/testcases/sets/0044json_prefix_in_concat_0 b/tests/shell/testcases/sets/0044json_prefix_in_concat_0
new file mode 100755
index 000000000000..9bc48caa136f
--- /dev/null
+++ b/tests/shell/testcases/sets/0044json_prefix_in_concat_0
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# JSON parsing "prefix" inside "concat" for a set element
+
+RULESET='{"nftables": [{"metainfo": {"json_schema_version": 1}},
+ {"add": {"table": {"family": "inet", "name": "foobar_table"}}},
+ {"add": {"set": {"family": "inet", "name": "foobar_set", "table": "foobar_table", "type": ["ipv4_addr", "inet_proto", "inet_service"]}}},
+ {"add": {"element": {"elem": [{"concat": [{"prefix": {"addr": "10.10.10.0", "len": 24}}, "sctp", "1234"]}], "family": "inet", "name": "foobar_set", "table": "foobar_table"}}}]}'
+
+set -e
+$NFT -j -f - <<< "$RULESET"
--
2.23.0
next prev parent reply other threads:[~2020-02-20 17:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 17:12 [PATCH 1/2] parser_json: fix parsing prefix inside concat Eric Garver
2020-02-20 17:12 ` Eric Garver [this message]
2020-02-21 18:16 ` Eric Garver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200220171242.15240-2-eric@garver.life \
--to=eric@garver.life \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.