summaryrefslogtreecommitdiffstats
path: root/tests/py/ip
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-01-21 16:46:27 +0100
committerFlorian Westphal <fw@strlen.de>2021-01-26 14:30:16 +0100
commit00a5917965998e34e2d9c38f9e8a242aacf48389 (patch)
tree0f31a2637c56e1a28a8617c0a8df8886ac0edadd /tests/py/ip
parent7d3a0799cfd0a7dbd179f2742b6632e66d1e9b6a (diff)
json: icmp: move expected parts to json.output
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>
Diffstat (limited to 'tests/py/ip')
-rw-r--r--tests/py/ip/icmp.t.json73
-rw-r--r--tests/py/ip/icmp.t.json.output134
2 files changed, 98 insertions, 109 deletions
diff --git a/tests/py/ip/icmp.t.json b/tests/py/ip/icmp.t.json
index 480740af..9691f072 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
@@ -718,23 +718,6 @@
"match": {
"left": {
"payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
- {
- "match": {
- "left": {
- "payload": {
"field": "id",
"protocol": "icmp"
}
@@ -754,23 +737,6 @@
"match": {
"left": {
"payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
- {
- "match": {
- "left": {
- "payload": {
"field": "id",
"protocol": "icmp"
}
@@ -787,23 +753,6 @@
"match": {
"left": {
"payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
- {
- "match": {
- "left": {
- "payload": {
"field": "id",
"protocol": "icmp"
}
@@ -896,23 +845,6 @@
"match": {
"left": {
"payload": {
- "field": "type",
- "protocol": "icmp"
- }
- },
- "op": "==",
- "right": {
- "set": [
- "echo-reply",
- "echo-request"
- ]
- }
- }
- },
- {
- "match": {
- "left": {
- "payload": {
"field": "id",
"protocol": "icmp"
}
@@ -1911,4 +1843,3 @@
}
}
]
-
diff --git a/tests/py/ip/icmp.t.json.output b/tests/py/ip/icmp.t.json.output
index 2391983a..5a075858 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
+ ]
+ }
+ ]
+ }
+ }
}
]
+