From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Thomas Haller <thaller@redhat.com>
Cc: NetFilter <netfilter-devel@vger.kernel.org>,
Phil Sutter <phil@nwl.cc>, Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH nft v3 1/1] tests/shell: sanitize "handle" in JSON output
Date: Wed, 22 Nov 2023 11:36:00 +0100 [thread overview]
Message-ID: <ZV3ZkD0Yi15ICNZT@calendula> (raw)
In-Reply-To: <20231121132331.3401846-1-thaller@redhat.com>
On Tue, Nov 21, 2023 at 02:22:54PM +0100, Thomas Haller wrote:
> The "handle" in JSON output is not stable. Sanitize/normalize to zero.
>
> Adjust the sanitize code, and regenerate the .json-nft files.
Applied, thanks.
I had to adjust a json dump, this diff is not so difficult:
--- testcases/sets/dumps/0062set_connlimit_0.json-nft 2023-11-22 10:34:55.767232540 +0100
+++ /tmp/nft-test.20231122-103617.664.6hTWZt/test-testcases-sets-0062set_connlimit_0.1/ruleset-after.json 2023-11-22 10:36:19.338350215 +0100
@@ -1 +1 @@
-{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "x", "handle": 0}}, {"set": {"family": "ip", "name": "est-connlimit", "table": "x", "type": "ipv4_addr", "handle": 0, "size": 65535, "flags": ["dynamic"], "elem": [{"elem": {"val": "84.245.120.167", "ct count": {"val": 20, "inv": true}}}]}}, {"set": {"family": "ip", "name": "new-connlimit", "table": "x", "type": "ipv4_addr", "handle": 0, "size": 65535, "flags": ["dynamic"], "elem": [{"elem": {"val": "84.245.120.167", "ct count": {"val": 20, "inv": true}}}], "stmt": [{"ct count": {"val": 20, "inv": true}}]}}]}
+{"nftables": [{"metainfo": {"version": "VERSION", "release_name": "RELEASE_NAME", "json_schema_version": 1}}, {"table": {"family": "ip", "name": "x", "handle": 0}}, {"set": {"family": "ip", "name": "est-connlimit", "table": "x", "type": "ipv4_addr", "handle": 0, "size": 65535, "flags": ["dynamic"]}}, {"set": {"family": "ip", "name": "new-connlimit", "table": "x", "type": "ipv4_addr", "handle": 0, "size": 65535, "flags": ["dynamic"], "stmt": [{"ct count": {"val": 20, "inv": true}}]}}]}
I had to adjust a different much larger dump though, and it feels a
bit like searching the needle in the stack in the diff (if a bug ever
shows up in this path). Usability improvement via python script
similar to what tests/py does would be really great to have.
Thanks.
next prev parent reply other threads:[~2023-11-22 10:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 17:18 [PATCH nft 1/1] tests/shell: sanitize "handle" in JSON output Thomas Haller
2023-11-18 2:36 ` Phil Sutter
2023-11-21 12:10 ` Thomas Haller
2023-11-21 12:39 ` Phil Sutter
2023-11-21 12:58 ` Thomas Haller
2023-11-21 13:40 ` Phil Sutter
2023-11-21 14:35 ` Thomas Haller
2023-11-21 15:19 ` Phil Sutter
2023-11-21 12:45 ` Pablo Neira Ayuso
[not found] ` <20231121132331.3401846-1-thaller@redhat.com>
2023-11-22 10:36 ` Pablo Neira Ayuso [this message]
2023-11-22 10:44 ` [PATCH nft v3 " Thomas Haller
2023-11-22 11:22 ` Pablo Neira Ayuso
2023-11-22 12:16 ` Thomas Haller
2023-11-22 12:32 ` Pablo Neira Ayuso
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=ZV3ZkD0Yi15ICNZT@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=thaller@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.