From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] json: icmp: move expected parts to json.output
Date: Thu, 21 Jan 2021 16:48:30 +0100 [thread overview]
Message-ID: <20210121154830.22530-1-fw@strlen.de> (raw)
Phil Sutter says:
In general, *.t.json files should contain JSON equivalents for rules as
they are *input* into nft. So we want them to be as close to the
introductory standard syntax comment as possible.
Undo earlier change and place the expected dependency added by
nft internals to json.output rather than icmp.t.json.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
tests/py/ip/icmp.t.json | 73 +-----------------
tests/py/ip/icmp.t.json.output | 134 +++++++++++++++++++++++----------
2 files changed, 98 insertions(+), 109 deletions(-)
diff --git a/tests/py/ip/icmp.t.json b/tests/py/ip/icmp.t.json
index 480740afb525..9691f0727f5e 100644
--- a/tests/py/ip/icmp.t.json
+++ b/tests/py/ip/icmp.t.json
@@ -485,8 +485,8 @@
"op": "==",
"right": {
"set": [
- "prot-unreachable",
- "frag-needed",
+ 2,
+ 4,
33,
54,
56
@@ -714,23 +714,6 @@
# icmp id 1245 log
[
- {
- "match": {
- "left": {
- "payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
{
"match": {
"left": {
@@ -750,23 +733,6 @@
# icmp id 22
[
- {
- "match": {
- "left": {
- "payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
{
"match": {
"left": {
@@ -783,23 +749,6 @@
# icmp id != 233
[
- {
- "match": {
- "left": {
- "payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
{
"match": {
"left": {
@@ -892,23 +841,6 @@
# icmp id { 33-55}
[
- {
- "match": {
- "left": {
- "payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
{
"match": {
"left": {
@@ -1911,4 +1843,3 @@
}
}
]
-
diff --git a/tests/py/ip/icmp.t.json.output b/tests/py/ip/icmp.t.json.output
index 2391983ab826..5a075858e8fa 100644
--- a/tests/py/ip/icmp.t.json.output
+++ b/tests/py/ip/icmp.t.json.output
@@ -1,4 +1,28 @@
-# icmp type {echo-reply, destination-unreachable, source-quench, redirect, echo-request, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply, router-advertisement, router-solicitation} accept
+# icmp code { 2, 4, 54, 33, 56}
+[
+ {
+ "match": {
+ "left": {
+ "payload": {
+ "field": "code",
+ "protocol": "icmp"
+ }
+ },
+ "op": "==",
+ "right": {
+ "set": [
+ "prot-unreachable",
+ "frag-needed",
+ 33,
+ 54,
+ 56
+ ]
+ }
+ }
+ }
+]
+
+# icmp id 1245 log
[
{
"match": {
@@ -8,104 +32,138 @@
"protocol": "icmp"
}
},
- "op": "==",
+ "op": "==",
"right": {
"set": [
"echo-reply",
- "destination-unreachable",
- "source-quench",
- "redirect",
- "echo-request",
- "router-advertisement",
- "router-solicitation",
- "time-exceeded",
- "parameter-problem",
- "timestamp-request",
- "timestamp-reply",
- "info-request",
- "info-reply",
- "address-mask-request",
- "address-mask-reply"
+ "echo-request"
]
}
}
},
{
- "accept": null
+ "match": {
+ "left": {
+ "payload": {
+ "field": "id",
+ "protocol": "icmp"
+ }
+ },
+ "op": "==",
+ "right": 1245
+ }
+ },
+ {
+ "log": null
}
]
-# icmp code { 2, 4, 54, 33, 56}
+# icmp id 22
[
{
"match": {
"left": {
"payload": {
- "field": "code",
+ "field": "type",
"protocol": "icmp"
}
},
"op": "==",
"right": {
"set": [
- "prot-unreachable",
- "frag-needed",
- 33,
- 54,
- 56
+ "echo-reply",
+ "echo-request"
]
}
}
+ },
+ {
+ "match": {
+ "left": {
+ "payload": {
+ "field": "id",
+ "protocol": "icmp"
+ }
+ },
+ "op": "==",
+ "right": 22
+ }
}
]
-# icmp checksum { 1111, 222, 343} accept
+# icmp id != 233
[
{
"match": {
"left": {
"payload": {
- "field": "checksum",
+ "field": "type",
"protocol": "icmp"
}
},
- "op": "==",
+ "op": "==",
"right": {
"set": [
- 222,
- 343,
- 1111
+ "echo-reply",
+ "echo-request"
]
}
}
},
{
- "accept": null
+ "match": {
+ "left": {
+ "payload": {
+ "field": "id",
+ "protocol": "icmp"
+ }
+ },
+ "op": "!=",
+ "right": 233
+ }
}
]
-# icmp checksum != { 1111, 222, 343} accept
+# icmp id { 33-55}
[
{
"match": {
"left": {
"payload": {
- "field": "checksum",
+ "field": "type",
"protocol": "icmp"
}
},
- "op": "!=",
+ "op": "==",
"right": {
"set": [
- 222,
- 343,
- 1111
+ "echo-reply",
+ "echo-request"
]
}
}
},
{
- "accept": null
+ "match": {
+ "left": {
+ "payload": {
+ "field": "id",
+ "protocol": "icmp"
+ }
+ },
+ "op": "==",
+ "right": {
+ "set": [
+ {
+ "range": [
+ 33,
+ 55
+ ]
+ }
+ ]
+ }
+ }
}
]
+
--
2.26.2
reply other threads:[~2021-01-21 17:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210121154830.22530-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).