summaryrefslogtreecommitdiffstats
path: root/tests/py/any
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2025-02-27 15:52:08 +0100
committerFlorian Westphal <fw@strlen.de>2025-03-06 04:55:43 +0100
commit3d6ad54dbc74449e171823cdaf9d43cd41721b8d (patch)
tree15771e54557e33cd6b6c4b6e28d8da24446143b0 /tests/py/any
parent9832c2c347eb09eb8790e2ea003855f92b2ac257 (diff)
expression: propagate key datatype for anonymous sets
set s { typeof tcp option mptcp subtype elements = { mp-join, dss } } is listed correctly. The set key provides the 'mptcpopt_subtype' information and listing can print all elements with symbolic names. In anon set case this doesn't work: tcp option mptcp subtype { mp-join, dss } is printed as "... subtype { 1, 2}" because the anon set only provides plain integer type. This change propagates the datatype to the individual members of the anon set. After this change, multiple existing data types such as TYPE_ICMP_TYPE could theoretically be replaced by integer-type aliases. However, those datatypes are already exposed to userspace via the 'set type' keyword. Thus removing them will break set definitions that use them. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py/any')
-rw-r--r--tests/py/any/tcpopt.t2
-rw-r--r--tests/py/any/tcpopt.t.json11
-rw-r--r--tests/py/any/tcpopt.t.payload10
3 files changed, 14 insertions, 9 deletions
diff --git a/tests/py/any/tcpopt.t b/tests/py/any/tcpopt.t
index a2fcdb3a..79699e23 100644
--- a/tests/py/any/tcpopt.t
+++ b/tests/py/any/tcpopt.t
@@ -53,7 +53,7 @@ tcp option mptcp exists;ok
tcp option mptcp subtype mp-capable;ok
tcp option mptcp subtype 1;ok;tcp option mptcp subtype mp-join
-tcp option mptcp subtype { 0, 2};ok
+tcp option mptcp subtype { mp-capable, mp-join, remove-addr, mp-prio, mp-fail, mp-fastclose, mp-tcprst };ok
reset tcp option mptcp;ok
reset tcp option 2;ok;reset tcp option maxseg
diff --git a/tests/py/any/tcpopt.t.json b/tests/py/any/tcpopt.t.json
index ea580473..a02e71b6 100644
--- a/tests/py/any/tcpopt.t.json
+++ b/tests/py/any/tcpopt.t.json
@@ -565,7 +565,7 @@
}
]
-# tcp option mptcp subtype { 0, 2}
+# tcp option mptcp subtype { mp-capable, mp-join, remove-addr, mp-prio, mp-fail, mp-fastclose, mp-tcprst }
[
{
"match": {
@@ -578,8 +578,13 @@
"op": "==",
"right": {
"set": [
- 0,
- 2
+ "mp-capable",
+ "mp-join",
+ "remove-addr",
+ "mp-prio",
+ "mp-fail",
+ "mp-fastclose",
+ "mp-tcprst"
]
}
}
diff --git a/tests/py/any/tcpopt.t.payload b/tests/py/any/tcpopt.t.payload
index e3cf500b..af8c4317 100644
--- a/tests/py/any/tcpopt.t.payload
+++ b/tests/py/any/tcpopt.t.payload
@@ -180,11 +180,11 @@ inet
[ bitwise reg 1 = ( reg 1 & 0x000000f0 ) ^ 0x00000000 ]
[ cmp eq reg 1 0x00000010 ]
-# tcp option mptcp subtype { 0, 2}
-__set%d test-inet 3 size 2
-__set%d test-inet 0
- element 00000000 : 0 [end] element 00000020 : 0 [end]
-inet
+# tcp option mptcp subtype { mp-capable, mp-join, remove-addr, mp-prio, mp-fail, mp-fastclose, mp-tcprst }
+__set%d test-ip4 3 size 7
+__set%d test-ip4 0
+ element 00000000 : 0 [end] element 00000010 : 0 [end] element 00000040 : 0 [end] element 00000050 : 0 [end] element 00000060 : 0 [end] element 00000070 : 0 [end] element 00000080 : 0 [end]
+ip test-ip4 input
[ exthdr load tcpopt 1b @ 30 + 2 => reg 1 ]
[ bitwise reg 1 = ( reg 1 & 0x000000f0 ) ^ 0x00000000 ]
[ lookup reg 1 set __set%d ]