json: Do not reduce single-item arrays on output
Phil Sutter
reviewercover json: Do not reduce single-item arrays on output
This series consists of noise (patches 1-13 and most of patch 14) with a bit of signal in patch 14. This is because the relatively simple adjustment to JSON output requires minor adjustments to many stored JSON dumps in shell test suite and stored JSON output in py test suite. While doing this, I noticed some dups and stale entries in py test suite. To clean things up first, I ran tests/py/tools/test-sanitizer.sh, fixed the warnings and sorted the changes into fixes for the respective commits.
Phil Sutter (14):
tests: py: Drop duplicate test in any/meta.t
tests: py: Drop stale entries since redundant test case removal
tests: py: Drop stale payload from any/rawpayload.t.payload
tests: py: Drop duplicate test from inet/geneve.t
tests: py: Drop duplicate test from inet/gre.t
tests: py: Drop duplicate test from inet/gretap.t
tests: py: Drop stale entry from inet/tcp.t.json
tests: py: Drop duplicate test from inet/vxlan.t
tests: py: Drop redundant payloads for ip/ip.t
tests: py: Drop stale entry from ip/snat.t.json
tests: py: Drop stale entries from ip6/{ct,meta}.t.json
tests: py: Drop stale entry from ip/snat.t.payload
tests: py: Fix tests added for 'icmpv6 taddr' support
json: Do not reduce single-item arrays on output
src/json.c | 8 +- tests/py/any/log.t.json.output | 15 +- tests/py/any/meta.t | 1 - tests/py/any/meta.t.json | 38 --- tests/py/any/queue.t.json.output | 117 ++++++++ tests/py/any/rawpayload.t.payload | 6 - tests/py/inet/fib.t.json | 8 +- tests/py/inet/fib.t.json.output | 87 +++++- tests/py/inet/geneve.t | 1 - tests/py/inet/geneve.t.json | 29 -- tests/py/inet/gre.t | 1 - tests/py/inet/gre.t.json | 17 -- tests/py/inet/gretap.t | 1 - tests/py/inet/gretap.t.json | 17 -- tests/py/inet/snat.t.json.output | 22 ++ tests/py/inet/synproxy.t.json | 8 +- tests/py/inet/synproxy.t.json.output | 8 +- tests/py/inet/tcp.t.json | 31 --- tests/py/inet/vxlan.t | 1 - tests/py/inet/vxlan.t.json | 29 -- tests/py/ip/ip.t.payload.bridge | 261 ------------------ tests/py/ip/ip.t.payload.inet | 176 ------------ tests/py/ip/masquerade.t.json.output | 46 +++ tests/py/ip/redirect.t.json.output | 118 ++++++++ tests/py/ip/snat.t.json | 33 --- tests/py/ip/snat.t.json.output | 8 +- tests/py/ip/snat.t.payload | 14 - tests/py/ip6/ct.t.json | 164 ----------- tests/py/ip6/dst.t.json | 23 -- tests/py/ip6/dst.t.payload.inet | 10 - tests/py/ip6/dst.t.payload.ip6 | 8 - tests/py/ip6/frag.t.json | 121 -------- tests/py/ip6/icmpv6.t | 2 - tests/py/ip6/icmpv6.t.json | 58 ---- tests/py/ip6/icmpv6.t.json.output | 36 +++ tests/py/ip6/ip6.t.json | 40 --- tests/py/ip6/masquerade.t.json.output | 46 +++ tests/py/ip6/meta.t.json | 58 ---- tests/py/ip6/redirect.t.json.output | 70 +++++ .../cache/dumps/0002_interval_0.json-nft | 4 +- .../netdev_chain_dormant_autoremove.json-nft | 4 +- .../json/dumps/0001set_statements_0.json-nft | 4 +- tests/shell/testcases/json/single_flag | 48 ++-- .../listing/dumps/0010sets_0.json-nft | 8 +- .../listing/dumps/0012sets_0.json-nft | 8 +- .../listing/dumps/0022terse_0.json-nft | 4 +- ...5interval_map_add_many_elements_0.json-nft | 4 +- .../dumps/0006interval_map_overlap_0.json-nft | 4 +- .../dumps/0008interval_map_delete_0.json-nft | 4 +- .../maps/dumps/0012map_concat_0.json-nft | 4 +- .../testcases/maps/dumps/0013map_0.json-nft | 4 +- .../maps/dumps/delete_element.json-nft | 4 +- .../dumps/delete_element_catchall.json-nft | 4 +- .../maps/dumps/map_with_flags_0.json-nft | 4 +- .../maps/dumps/named_ct_objects.json-nft | 8 +- .../maps/dumps/named_limits.json-nft | 8 +- .../maps/dumps/pipapo_double_flush.json-nft | 4 +- .../maps/dumps/typeof_integer_0.json-nft | 4 +- .../dumps/typeof_maps_add_delete.json-nft | 4 +- .../maps/dumps/typeof_maps_update_0.json-nft | 8 +- .../maps/dumps/vmap_timeout.json-nft | 8 +- .../testcases/maps/dumps/vmap_unary.json-nft | 4 +- .../dumps/0012different_defines_0.json-nft | 8 +- .../nft-f/dumps/0025empty_dynset_0.json-nft | 12 +- .../testcases/nft-i/dumps/set_0.json-nft | 4 +- .../optimizations/dumps/merge_vmaps.json-nft | 4 +- .../dumps/skip_unsupported.json-nft | 4 +- .../packetpath/dumps/set_lookups.json-nft | 8 +- .../dumps/0004replace_0.json-nft | 4 +- .../dumps/0011reset_0.json-nft | 4 +- .../sets/dumps/0001named_interval_0.json-nft | 16 +- .../0002named_interval_automerging_0.json-nft | 4 +- .../0004named_interval_shadow_0.json-nft | 4 +- .../0005named_interval_shadow_0.json-nft | 4 +- .../dumps/0008comments_interval_0.json-nft | 4 +- .../dumps/0009comments_timeout_0.json-nft | 4 +- .../sets/dumps/0015rulesetflush_0.json-nft | 4 +- .../dumps/0022type_selective_flush_0.json-nft | 4 +- .../sets/dumps/0024synproxy_0.json-nft | 4 +- .../sets/dumps/0027ipv6_maps_ipv4_0.json-nft | 4 +- .../sets/dumps/0028autoselect_0.json-nft | 12 +- .../sets/dumps/0028delete_handle_0.json-nft | 4 +- .../dumps/0032restore_set_simple_0.json-nft | 8 +- .../dumps/0033add_set_simple_flat_0.json-nft | 8 +- .../sets/dumps/0034get_element_0.json-nft | 12 +- .../0035add_set_elements_flat_0.json-nft | 4 +- .../sets/dumps/0038meter_list_0.json-nft | 4 +- .../sets/dumps/0039delete_interval_0.json-nft | 4 +- .../0040get_host_endian_elements_0.json-nft | 4 +- .../sets/dumps/0041interval_0.json-nft | 4 +- .../sets/dumps/0042update_set_0.json-nft | 4 +- .../dumps/0043concatenated_ranges_1.json-nft | 8 +- .../dumps/0044interval_overlap_1.json-nft | 4 +- .../sets/dumps/0046netmap_0.json-nft | 16 +- .../sets/dumps/0049set_define_0.json-nft | 4 +- .../dumps/0051set_interval_counter_0.json-nft | 4 +- .../sets/dumps/0052overlap_0.json-nft | 4 +- .../sets/dumps/0054comments_set_0.json-nft | 8 +- .../sets/dumps/0055tcpflags_0.json-nft | 4 +- .../sets/dumps/0060set_multistmt_1.json-nft | 4 +- .../sets/dumps/0062set_connlimit_0.json-nft | 8 +- .../sets/dumps/0063set_catchall_0.json-nft | 4 +- .../sets/dumps/0064map_catchall_0.json-nft | 4 +- .../sets/dumps/0069interval_merge_0.json-nft | 4 +- .../0071unclosed_prefix_interval_0.json-nft | 8 +- .../sets/dumps/0073flat_interval_set.json-nft | 4 +- .../dumps/0074nested_interval_set.json-nft | 4 +- .../sets/dumps/concat_interval_0.json-nft | 8 +- .../sets/dumps/concat_nlmsg_overrun.json-nft | 4 +- .../sets/dumps/dynset_missing.json-nft | 4 +- .../sets/dumps/exact_overlap_0.json-nft | 4 +- .../testcases/sets/dumps/inner_0.json-nft | 4 +- .../sets/dumps/interval_size.json-nft | 8 +- .../sets/dumps/meter_set_reuse.json-nft | 4 +- .../dumps/range_with_same_start_end.json-nft | 4 +- .../set_element_timeout_updates.json-nft | 4 +- .../testcases/sets/dumps/set_eval_0.json-nft | 4 +- .../sets/dumps/sets_with_ifnames.json-nft | 12 +- .../sets/dumps/typeof_sets_concat.json-nft | 4 +- .../transactions/dumps/0002table_0.json-nft | 4 +- .../transactions/dumps/0037set_0.json-nft | 4 +- .../transactions/dumps/0038set_0.json-nft | 4 +- .../transactions/dumps/0039set_0.json-nft | 4 +- .../transactions/dumps/0047set_0.json-nft | 4 +- .../transactions/dumps/doubled-set.json-nft | 4 +- .../transactions/dumps/table_onoff.json-nft | 4 +- 126 files changed, 944 insertions(+), 1305 deletions(-) create mode 100644 tests/py/inet/snat.t.json.output
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 1/14 tests: py: Drop duplicate test in any/meta.t
The expected invalid meta hour argument of 24:00 is tested already.
--- tests/py/any/meta.t | 1 - 1 file changed, 1 deletion(-)
tests/py/any/meta.t +0 -1
@@ -221,7 +221,6 @@ meta hour "00:01" drop;ok meta hour "01:01" drop;ok meta hour "02:02" drop;ok meta hour "03:03" drop;ok -meta hour "24:00" drop;fail meta hour "23:59:60" drop;ok;meta hour "00:00" drop meta hour "00:00"-"02:02" drop;ok meta hour "01:01"-"03:03" drop;ok
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 2/14 tests: py: Drop stale entries since redundant test case removal
In reply to Phil SutterFixed commit left stale JSON equivalents and payload records in place, drop them.
--- tests/py/any/meta.t.json | 38 ---------- tests/py/ip6/dst.t.json | 23 ------ tests/py/ip6/dst.t.payload.inet | 10 --- tests/py/ip6/dst.t.payload.ip6 | 8 --- tests/py/ip6/frag.t.json | 121 -------------------------------- tests/py/ip6/ip6.t.json | 40 ----------- 6 files changed, 240 deletions(-)
tests/py/any/meta.t.json +0 -38
@@ -2294,44 +2294,6 @@ } ] -# meta cgroup {1048577-1048578} -[ - { - "match": { - "left": { - "meta": { "key": "cgroup" } - }, - "op": "==", - "right": { - "set": [ - { - "range": [ 1048577, 1048578 ] - } - ] - } - } - } -] - -# meta cgroup != { 1048577-1048578} -[ - { - "match": { - "left": { - "meta": { "key": "cgroup" } - }, - "op": "!=", - "right": { - "set": [ - { - "range": [ 1048577, 1048578 ] - } - ] - } - } - } -] - # meta iif . meta oif { "lo" . "lo" } [ {
tests/py/ip6/dst.t.json +0 -23
@@ -290,26 +290,3 @@ } } ] - -# dst hdrlength != { 33, 55, 67, 88} -[ - { - "match": { - "left": { - "exthdr": { - "field": "hdrlength", - "name": "dst" - } - }, - "op": "!=", - "right": { - "set": [ - 33, - 55, - 67, - 88 - ] - } - } - } -]
tests/py/ip6/dst.t.payload.inet +0 -10
@@ -117,13 +117,3 @@ ip6 test-ip6 input [ cmp eq reg 1 0x0000000a ] [ exthdr load ipv6 1b @ 60 + 1 => reg 1 ] [ lookup reg 1 set __set%d ] - -# dst hdrlength != { 33, 55, 67, 88} -__set%d test-ip6 3 -__set%d test-ip6 0 - element 00000021 : 0 [end] element 00000037 : 0 [end] element 00000043 : 0 [end] element 00000058 : 0 [end] -ip6 test-ip6 input - [ meta load nfproto => reg 1 ] - [ cmp eq reg 1 0x0000000a ] - [ exthdr load ipv6 1b @ 60 + 1 => reg 1 ] - [ lookup reg 1 set __set%d 0x1 ]
tests/py/ip6/dst.t.payload.ip6 +0 -8
@@ -87,11 +87,3 @@ __set%d test-ip6 0 ip6 test-ip6 input [ exthdr load ipv6 1b @ 60 + 1 => reg 1 ] [ lookup reg 1 set __set%d ] - -# dst hdrlength != { 33, 55, 67, 88} -__set%d test-ip6 3 -__set%d test-ip6 0 - element 00000021 : 0 [end] element 00000037 : 0 [end] element 00000043 : 0 [end] element 00000058 : 0 [end] -ip6 test-ip6 input - [ exthdr load ipv6 1b @ 60 + 1 => reg 1 ] - [ lookup reg 1 set __set%d 0x1 ]
tests/py/ip6/frag.t.json +0 -121
136 lines not on this page · raw message
tests/py/ip6/ip6.t.json +0 -40
@@ -571,46 +571,6 @@ } ] -# ip6 nexthdr { 33-44} -[ - { - "match": { - "left": { - "payload": { - "field": "nexthdr", - "protocol": "ip6" - } - }, - "op": "==", - "right": { - "set": [ - { "range": [ 33, 44 ] } - ] - } - } - } -] - -# ip6 nexthdr != { 33-44} -[ - { - "match": { - "left": { - "payload": { - "field": "nexthdr", - "protocol": "ip6" - } - }, - "op": "!=", - "right": { - "set": [ - { "range": [ 33, 44 ] } - ] - } - } - } -] - # ip6 nexthdr 33-44 [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 3/14 tests: py: Drop stale payload from any/rawpayload.t.payload
In reply to Phil SutterThere never was a test corresponding to this payload.
--- tests/py/any/rawpayload.t.payload | 6 ------ 1 file changed, 6 deletions(-)
tests/py/any/rawpayload.t.payload +0 -6
@@ -111,12 +111,6 @@ inet test-inet input [ bitwise reg 1 = ( reg 1 & 0x00000060 ) ^ 0x00000000 ] [ cmp eq reg 1 0x00000040 ] -# @ih,2,1 0x1 -inet test-inet input - [ payload load 1b @ inner header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x00000020 ) ^ 0x00000000 ] - [ cmp eq reg 1 0x00000020 ] - # @ih,35,3 0x2 inet test-inet input [ payload load 1b @ inner header + 4 => reg 1 ]
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 4/14 tests: py: Drop duplicate test from inet/geneve.t
In reply to Phil SutterThe test was duplicate since day 1. The duplicate JSON equivalent was added later (semi-automated), remove it as well.
--- tests/py/inet/geneve.t | 1 - tests/py/inet/geneve.t.json | 29 ----------------------------- 2 files changed, 30 deletions(-)
tests/py/inet/geneve.t +0 -1
@@ -17,7 +17,6 @@ udp dport 6081 geneve icmp type echo-reply;ok udp dport 6081 geneve ether saddr 62:87:4d:d6:19:05;ok udp dport 6081 geneve vlan id 10;ok udp dport 6081 geneve ip dscp 0x02;ok -udp dport 6081 geneve ip dscp 0x02;ok udp dport 6081 geneve ip saddr . geneve ip daddr { 1.2.3.4 . 4.3.2.1 };ok udp dport 6081 geneve ip saddr set 1.2.3.4;fail
tests/py/inet/geneve.t.json +0 -29
@@ -264,35 +264,6 @@ } ] -# udp dport 6081 geneve ip dscp 0x02 -[ - { - "match": { - "left": { - "payload": { - "field": "dport", - "protocol": "udp" - } - }, - "op": "==", - "right": 6081 - } - }, - { - "match": { - "left": { - "payload": { - "field": "dscp", - "protocol": "ip", - "tunnel": "geneve" - } - }, - "op": "==", - "right": 2 - } - } -] - # udp dport 6081 geneve ip saddr . geneve ip daddr { 1.2.3.4 . 4.3.2.1 } [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 5/14 tests: py: Drop duplicate test from inet/gre.t
In reply to Phil SutterThe test was duplicate since day 1. The duplicate JSON equivalent was added later (semi-automated), remove it as well.
--- tests/py/inet/gre.t | 1 - tests/py/inet/gre.t.json | 17 ----------------- 2 files changed, 18 deletions(-)
tests/py/inet/gre.t +0 -1
@@ -16,7 +16,6 @@ gre icmp type echo-reply;ok gre ether saddr 62:87:4d:d6:19:05;fail gre vlan id 10;fail gre ip dscp 0x02;ok -gre ip dscp 0x02;ok gre ip saddr . gre ip daddr { 1.2.3.4 . 4.3.2.1 };ok gre ip saddr set 1.2.3.4;fail
tests/py/inet/gre.t.json +0 -17
@@ -121,23 +121,6 @@ } ] -# gre ip dscp 0x02 -[ - { - "match": { - "left": { - "payload": { - "field": "dscp", - "protocol": "ip", - "tunnel": "gre" - } - }, - "op": "==", - "right": 2 - } - } -] - # gre ip saddr . gre ip daddr { 1.2.3.4 . 4.3.2.1 } [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 6/14 tests: py: Drop duplicate test from inet/gretap.t
In reply to Phil SutterThe test was duplicate since day 1. The duplicate JSON equivalent was added later (semi-automated), remove it as well.
--- tests/py/inet/gretap.t | 1 - tests/py/inet/gretap.t.json | 17 ----------------- 2 files changed, 18 deletions(-)
tests/py/inet/gretap.t +0 -1
@@ -15,7 +15,6 @@ gretap icmp type echo-reply;ok gretap ether saddr 62:87:4d:d6:19:05;ok gretap vlan id 10;ok gretap ip dscp 0x02;ok -gretap ip dscp 0x02;ok gretap ip saddr . gretap ip daddr { 1.2.3.4 . 4.3.2.1 };ok gretap ip saddr set 1.2.3.4;fail
tests/py/inet/gretap.t.json +0 -17
@@ -139,23 +139,6 @@ } ] -# gretap ip dscp 0x02 -[ - { - "match": { - "left": { - "payload": { - "field": "dscp", - "protocol": "ip", - "tunnel": "gretap" - } - }, - "op": "==", - "right": 2 - } - } -] - # gretap ip saddr . gretap ip daddr { 1.2.3.4 . 4.3.2.1 } [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 7/14 tests: py: Drop stale entry from inet/tcp.t.json
In reply to Phil SutterThe test was changed but JSON equivalents not updated. Commit c0b685951fabb ("json: fix parse of flagcmp expression") then added an equivalent matching the changed test, so just drop the old one.
--- tests/py/inet/tcp.t.json | 31 ------------------------------- 1 file changed, 31 deletions(-)
tests/py/inet/tcp.t.json +0 -31
@@ -910,37 +910,6 @@ } ] -# tcp flags & (syn|fin) == (syn|fin) -[ - { - "match": { - "left": { - "&": [ - { - "payload": { - "field": "flags", - "protocol": "tcp" - } - }, - { - "|": [ - "syn", - "fin" - ] - } - ] - }, - "op": "==", - "right": { - "|": [ - "syn", - "fin" - ] - } - } - } -] - # tcp flags & (fin | syn | rst | psh | ack | urg | ecn | cwr) == fin | syn | rst | psh | ack | urg | ecn | cwr [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 8/14 tests: py: Drop duplicate test from inet/vxlan.t
In reply to Phil SutterThe test was duplicate since day 1. The duplicate JSON equivalent was added later (semi-automated), remove it as well.
--- tests/py/inet/vxlan.t | 1 - tests/py/inet/vxlan.t.json | 29 ----------------------------- 2 files changed, 30 deletions(-)
tests/py/inet/vxlan.t +0 -1
@@ -17,7 +17,6 @@ udp dport 4789 vxlan icmp type echo-reply;ok udp dport 4789 vxlan ether saddr 62:87:4d:d6:19:05;ok udp dport 4789 vxlan vlan id 10;ok udp dport 4789 vxlan ip dscp 0x02;ok -udp dport 4789 vxlan ip dscp 0x02;ok udp dport 4789 vxlan ip saddr . vxlan ip daddr { 1.2.3.4 . 4.3.2.1 };ok udp dport 4789 vxlan ip saddr set 1.2.3.4;fail
tests/py/inet/vxlan.t.json +0 -29
@@ -264,35 +264,6 @@ } ] -# udp dport 4789 vxlan ip dscp 0x02 -[ - { - "match": { - "left": { - "payload": { - "field": "dport", - "protocol": "udp" - } - }, - "op": "==", - "right": 4789 - } - }, - { - "match": { - "left": { - "payload": { - "field": "dscp", - "protocol": "ip", - "tunnel": "vxlan" - } - }, - "op": "==", - "right": 2 - } - } -] - # udp dport 4789 vxlan ip saddr . vxlan ip daddr { 1.2.3.4 . 4.3.2.1 } [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 9/14 tests: py: Drop redundant payloads for ip/ip.t
In reply to Phil SutterEach was present multiple times, introduced probably by copying from a respective .got file.
--- tests/py/ip/ip.t.payload.bridge | 261 -------------------------------- tests/py/ip/ip.t.payload.inet | 176 --------------------- 2 files changed, 437 deletions(-)
tests/py/ip/ip.t.payload.bridge +0 -261
@@ -829,264 +829,3 @@ bridge test-bridge input [ payload load 2b @ network header + 0 => reg 1 ] [ bitwise reg 1 = ( reg 1 & 0x0000fff1 ) ^ 0x00000000 ] [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000200 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000100 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp | lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fbff ) ^ 0x00000400 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] -# ip dscp set ip dscp & lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x000007ff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp & 0x1f -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x00007fff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ffef ) ^ 0x00000010 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ff1f ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fffe ) ^ 0x00000001 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fff1 ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000200 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000100 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp | lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fbff ) ^ 0x00000400 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] -# ip dscp set ip dscp & lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x000007ff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp & 0x1f -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x00007fff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ffef ) ^ 0x00000010 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ff1f ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fffe ) ^ 0x00000001 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fff1 ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000200 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn | ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000100 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect0 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000feff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip ecn set ip ecn & ect1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fdff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp | lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fbff ) ^ 0x00000400 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] -# ip dscp set ip dscp & lephb -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x000007ff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip dscp set ip dscp & 0x1f -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x00007fff ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ffef ) ^ 0x00000010 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip version set ip version & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000ff1f ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength | 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fffe ) ^ 0x00000001 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ] - -# ip hdrlength set ip hdrlength & 1 -bridge test-bridge input - [ meta load protocol => reg 1 ] - [ cmp eq reg 1 0x00000008 ] - [ payload load 2b @ network header + 0 => reg 1 ] - [ bitwise reg 1 = ( reg 1 & 0x0000fff1 ) ^ 0x00000000 ] - [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 csum_flags 0x0 ]
tests/py/ip/ip.t.payload.inet +0 -176
179 lines not on this page · raw message
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 10/14 tests: py: Drop stale entry from ip/snat.t.json
In reply to Phil SutterThe test syntax was changed, but the respective JSON equivalent remained in place.
--- tests/py/ip/snat.t.json | 33 --------------------------------- 1 file changed, 33 deletions(-)
tests/py/ip/snat.t.json +0 -33
@@ -283,39 +283,6 @@ } ] -# snat ip interval to ip saddr map { 10.141.11.4 : 192.168.2.2-192.168.2.4 } -[ - { - "snat": { - "addr": { - "map": { - "data": { - "set": [ - [ - "10.141.11.4", - { - "range": [ - "192.168.2.2", - "192.168.2.4" - ] - } - ] - ] - }, - "key": { - "payload": { - "field": "saddr", - "protocol": "ip" - } - } - } - }, - "family": "ip", - "type_flags": "interval" - } - } -] - # snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24 } [ {
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 11/14 tests: py: Drop stale entries from ip6/{ct,meta}.t.json
In reply to Phil SutterLooks like these were added by accident, fixed commit did not add these test cases.
--- tests/py/ip6/ct.t.json | 164 --------------------------------------- tests/py/ip6/meta.t.json | 58 -------------- 2 files changed, 222 deletions(-)
tests/py/ip6/ct.t.json +0 -164
@@ -1,167 +1,3 @@ -# ct mark set ip6 dscp lshift 2 or 0x10 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "<<": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 2 - ] - }, - 16 - ] - } - } - } -] - -# ct mark set ip6 dscp lshift 26 or 0x10 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "<<": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 26 - ] - }, - 16 - ] - } - } - } -] - -# ct mark set ip6 dscp << 2 | 0x10 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "<<": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 2 - ] - }, - 16 - ] - } - } - } -] - -# ct mark set ip6 dscp << 26 | 0x10 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "<<": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 26 - ] - }, - 16 - ] - } - } - } -] - -# ct mark set ip6 dscp | 0x04 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 4 - ] - } - } - } -] - -# ct mark set ip6 dscp | 0xff000000 -[ - { - "mangle": { - "key": { - "ct": { - "key": "mark" - } - }, - "value": { - "|": [ - { - "payload": { - "field": "dscp", - "protocol": "ip6" - } - }, - 4278190080 - ] - } - } - } -] - # ct mark set ip6 dscp << 2 | 0x10 [ {
tests/py/ip6/meta.t.json +0 -58
64 lines not on this page · raw message
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 12/14 tests: py: Drop stale entry from ip/snat.t.payload
In reply to Phil SutterThis payload actually belongs to ip/dnat.t.payload, fixed commit added it to the wrong file.
--- tests/py/ip/snat.t.payload | 14 -------------- 1 file changed, 14 deletions(-)
tests/py/ip/snat.t.payload +0 -14
@@ -135,17 +135,3 @@ ip [ payload load 2b @ transport header + 2 => reg 9 ] [ lookup reg 1 set __map%d dreg 1 ] [ nat snat ip addr_min reg 1 proto_min reg 9 ] - -# ip daddr 192.168.0.1 dnat to tcp dport map { 443 : 10.141.10.4 . 8443, 80 : 10.141.10.4 . 8080 } -__map%d x b size 2 -__map%d x 0 - element 0000bb01 : 040a8d0a 0000fb20 0 [end] element 00005000 : 040a8d0a 0000901f 0 [end] -ip - [ payload load 4b @ network header + 16 => reg 1 ] - [ cmp eq reg 1 0x0100a8c0 ] - [ meta load l4proto => reg 1 ] - [ cmp eq reg 1 0x00000006 ] - [ payload load 2b @ transport header + 2 => reg 1 ] - [ lookup reg 1 set __map%d dreg 1 ] - [ nat dnat ip addr_min reg 1 proto_min reg 9 ] -
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 13/14 tests: py: Fix tests added for 'icmpv6 taddr' support
In reply to Phil SutterThere was a duplicate test, also stored JSON equivalents should match input as much as possible. The expected deviation in output (just like with standard syntax) is stored in the .json.output file instead.
--- tests/py/ip6/icmpv6.t | 2 -- tests/py/ip6/icmpv6.t.json | 58 ------------------------------- tests/py/ip6/icmpv6.t.json.output | 36 +++++++++++++++++++ 3 files changed, 36 insertions(+), 60 deletions(-)
tests/py/ip6/icmpv6.t +0 -2
@@ -91,8 +91,6 @@ icmpv6 type nd-neighbor-solicit icmpv6 taddr 2001:db8::133;ok icmpv6 type nd-neighbor-advert icmpv6 taddr 2001:db8::133;ok icmpv6 taddr 2001:db8::133;ok;icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect} icmpv6 taddr 2001:db8::133 -icmpv6 taddr 2001:db8::133;ok;icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect} icmpv6 taddr 2001:db8::133 - icmpv6 type { mld-listener-query, mld-listener-report, mld-listener-done, nd-neighbor-solicit, nd-neighbor-advert, nd-redirect} icmpv6 taddr 2001:db8::133;ok icmpv6 type { nd-neighbor-solicit, nd-neighbor-advert } icmpv6 taddr 2001:db8::133;ok icmpv6 daddr 2001:db8::133;ok
tests/py/ip6/icmpv6.t.json +0 -58
64 lines not on this page · raw message
tests/py/ip6/icmpv6.t.json.output +36 -0
@@ -696,3 +696,39 @@ } ] +# icmpv6 taddr 2001:db8::133 +[ + { + "match": { + "left": { + "payload": { + "field": "type", + "protocol": "icmpv6" + } + }, + "op": "==", + "right": { + "set": [ + "mld-listener-query", + "mld-listener-report", + "mld-listener-done", + "nd-neighbor-solicit", + "nd-neighbor-advert", + "nd-redirect" + ] + } + } + }, + { + "match": { + "left": { + "payload": { + "field": "taddr", + "protocol": "icmpv6" + } + }, + "op": "==", + "right": "2001:db8::133" + } + } +]
Signature · 1 line
2.49.0
Phil Sutter
reviewerPATCH 14/14 json: Do not reduce single-item arrays on output
In reply to Phil SutterThis is a partial revert of commit a740f2036ad0d ("json: Introduce json_add_array_new()"), keeping the function but eliminating its primary task which is to replace arrays of size 1 by their only item. While support for this on input is convenient for users, it means extra casing in JSON output parsers to cover for it. The minor reduction in output size does not justify that.
--- src/json.c | 8 +- tests/py/any/log.t.json.output | 15 ++- tests/py/any/queue.t.json.output | 117 +++++++++++++++++ tests/py/inet/fib.t.json | 8 +- tests/py/inet/fib.t.json.output | 87 ++++++++++++- tests/py/inet/snat.t.json.output | 22 ++++ tests/py/inet/synproxy.t.json | 8 +- tests/py/inet/synproxy.t.json.output | 8 +- tests/py/ip/masquerade.t.json.output | 46 +++++++ tests/py/ip/redirect.t.json.output | 118 ++++++++++++++++++ tests/py/ip/snat.t.json.output | 8 +- tests/py/ip6/masquerade.t.json.output | 46 +++++++ tests/py/ip6/redirect.t.json.output | 70 +++++++++++ .../cache/dumps/0002_interval_0.json-nft | 4 +- .../netdev_chain_dormant_autoremove.json-nft | 4 +- .../json/dumps/0001set_statements_0.json-nft | 4 +- tests/shell/testcases/json/single_flag | 48 +++---- .../listing/dumps/0010sets_0.json-nft | 8 +- .../listing/dumps/0012sets_0.json-nft | 8 +- .../listing/dumps/0022terse_0.json-nft | 4 +- ...5interval_map_add_many_elements_0.json-nft | 4 +- .../dumps/0006interval_map_overlap_0.json-nft | 4 +- .../dumps/0008interval_map_delete_0.json-nft | 4 +- .../maps/dumps/0012map_concat_0.json-nft | 4 +- .../testcases/maps/dumps/0013map_0.json-nft | 4 +- .../maps/dumps/delete_element.json-nft | 4 +- .../dumps/delete_element_catchall.json-nft | 4 +- .../maps/dumps/map_with_flags_0.json-nft | 4 +- .../maps/dumps/named_ct_objects.json-nft | 8 +- .../maps/dumps/named_limits.json-nft | 8 +- .../maps/dumps/pipapo_double_flush.json-nft | 4 +- .../maps/dumps/typeof_integer_0.json-nft | 4 +- .../dumps/typeof_maps_add_delete.json-nft | 4 +- .../maps/dumps/typeof_maps_update_0.json-nft | 8 +- .../maps/dumps/vmap_timeout.json-nft | 8 +- .../testcases/maps/dumps/vmap_unary.json-nft | 4 +- .../dumps/0012different_defines_0.json-nft | 8 +- .../nft-f/dumps/0025empty_dynset_0.json-nft | 12 +- .../testcases/nft-i/dumps/set_0.json-nft | 4 +- .../optimizations/dumps/merge_vmaps.json-nft | 4 +- .../dumps/skip_unsupported.json-nft | 4 +- .../packetpath/dumps/set_lookups.json-nft | 8 +- .../dumps/0004replace_0.json-nft | 4 +- .../dumps/0011reset_0.json-nft | 4 +- .../sets/dumps/0001named_interval_0.json-nft | 16 ++- .../0002named_interval_automerging_0.json-nft | 4 +- .../0004named_interval_shadow_0.json-nft | 4 +- .../0005named_interval_shadow_0.json-nft | 4 +- .../dumps/0008comments_interval_0.json-nft | 4 +- .../dumps/0009comments_timeout_0.json-nft | 4 +- .../sets/dumps/0015rulesetflush_0.json-nft | 4 +- .../dumps/0022type_selective_flush_0.json-nft | 4 +- .../sets/dumps/0024synproxy_0.json-nft | 4 +- .../sets/dumps/0027ipv6_maps_ipv4_0.json-nft | 4 +- .../sets/dumps/0028autoselect_0.json-nft | 12 +- .../sets/dumps/0028delete_handle_0.json-nft | 4 +- .../dumps/0032restore_set_simple_0.json-nft | 8 +- .../dumps/0033add_set_simple_flat_0.json-nft | 8 +- .../sets/dumps/0034get_element_0.json-nft | 12 +- .../0035add_set_elements_flat_0.json-nft | 4 +- .../sets/dumps/0038meter_list_0.json-nft | 4 +- .../sets/dumps/0039delete_interval_0.json-nft | 4 +- .../0040get_host_endian_elements_0.json-nft | 4 +- .../sets/dumps/0041interval_0.json-nft | 4 +- .../sets/dumps/0042update_set_0.json-nft | 4 +- .../dumps/0043concatenated_ranges_1.json-nft | 8 +- .../dumps/0044interval_overlap_1.json-nft | 4 +- .../sets/dumps/0046netmap_0.json-nft | 16 ++- .../sets/dumps/0049set_define_0.json-nft | 4 +- .../dumps/0051set_interval_counter_0.json-nft | 4 +- .../sets/dumps/0052overlap_0.json-nft | 4 +- .../sets/dumps/0054comments_set_0.json-nft | 8 +- .../sets/dumps/0055tcpflags_0.json-nft | 4 +- .../sets/dumps/0060set_multistmt_1.json-nft | 4 +- .../sets/dumps/0062set_connlimit_0.json-nft | 8 +- .../sets/dumps/0063set_catchall_0.json-nft | 4 +- .../sets/dumps/0064map_catchall_0.json-nft | 4 +- .../sets/dumps/0069interval_merge_0.json-nft | 4 +- .../0071unclosed_prefix_interval_0.json-nft | 8 +- .../sets/dumps/0073flat_interval_set.json-nft | 4 +- .../dumps/0074nested_interval_set.json-nft | 4 +- .../sets/dumps/concat_interval_0.json-nft | 8 +- .../sets/dumps/concat_nlmsg_overrun.json-nft | 4 +- .../sets/dumps/dynset_missing.json-nft | 4 +- .../sets/dumps/exact_overlap_0.json-nft | 4 +- .../testcases/sets/dumps/inner_0.json-nft | 4 +- .../sets/dumps/interval_size.json-nft | 8 +- .../sets/dumps/meter_set_reuse.json-nft | 4 +- .../dumps/range_with_same_start_end.json-nft | 4 +- .../set_element_timeout_updates.json-nft | 4 +- .../testcases/sets/dumps/set_eval_0.json-nft | 4 +- .../sets/dumps/sets_with_ifnames.json-nft | 12 +- .../sets/dumps/typeof_sets_concat.json-nft | 4 +- .../transactions/dumps/0002table_0.json-nft | 4 +- .../transactions/dumps/0037set_0.json-nft | 4 +- .../transactions/dumps/0038set_0.json-nft | 4 +- .../transactions/dumps/0039set_0.json-nft | 4 +- .../transactions/dumps/0047set_0.json-nft | 4 +- .../transactions/dumps/doubled-set.json-nft | 4 +- .../transactions/dumps/table_onoff.json-nft | 4 +- 100 files changed, 908 insertions(+), 165 deletions(-) create mode 100644 tests/py/inet/snat.t.json.output
src/json.c +2 -6
@@ -62,14 +62,10 @@ static int json_array_extend_new(json_t *array, json_t *other_array)static void json_add_array_new (json_t *obj,const char *name,json_t *array) { -if (json_array_size (array) >1 ) { +if (json_array_size (array))json_object_set_new (obj, name, array); - }else { -if (json_array_size (array)) -json_object_set (obj, name, -json_array_get (array,0 )); +else json_decref (array); - } }static json_t *expr_print_json (const struct expr *expr,struct output_ctx *octx)
tests/py/any/log.t.json.output +14 -1
@@ -9,7 +9,20 @@ [ { "log": { - "flags": "all" + "flags": [ + "all" + ] + } + } +] + +# log flags all +[ + { + "log": { + "flags": [ + "all" + ] } } ]
tests/py/any/queue.t.json.output +117 -0
120 lines not on this page · raw message
tests/py/inet/fib.t.json +2 -6
@@ -100,9 +100,7 @@ "match": { "left": { "fib": { - "flags": [ - "daddr" - ], + "flags": "daddr", "result": "check" } },
@@ -118,9 +116,7 @@ "match": { "left": { "fib": { - "flags": [ - "daddr" - ], + "flags": "daddr", "result": "check" } },
tests/py/inet/fib.t.json.output +85 -2
102 lines not on this page · raw message
tests/py/inet/snat.t.json.output new file +22 -0
@@ -0,0 +1,22 @@ +# iifname "foo" masquerade random +[ + { + "match": { + "left": { + "meta": { + "key": "iifname" + } + }, + "op": "==", + "right": "foo" + } + }, + { + "masquerade": { + "flags": [ + "random" + ] + } + } +] +
tests/py/inet/synproxy.t.json +2 -6
@@ -19,9 +19,7 @@ [ { "synproxy": { - "flags": [ - "timestamp" - ] + "flags": "timestamp" } } ]
@@ -56,9 +54,7 @@ [ { "synproxy": { - "flags": [ - "sack-perm" - ] + "flags": "sack-perm" } } ]
tests/py/inet/synproxy.t.json.output +6 -2
@@ -2,7 +2,9 @@ [ { "synproxy": { - "flags": "timestamp" + "flags": [ + "timestamp" + ] } } ]
@@ -11,7 +13,9 @@ [ { "synproxy": { - "flags": "sack-perm" + "flags": [ + "sack-perm" + ] } } ]
tests/py/ip/masquerade.t.json.output +46 -0
49 lines not on this page · raw message
tests/py/ip/redirect.t.json.output +118 -0
124 lines not on this page · raw message
tests/py/ip/snat.t.json.output +6 -2
@@ -241,8 +241,12 @@ } }, "family": "ip", - "flags": "netmap", - "type_flags": "prefix" + "flags": [ + "netmap" + ], + "type_flags": [ + "prefix" + ] } } ]
tests/py/ip6/masquerade.t.json.output +46 -0
49 lines not on this page · raw message
tests/py/ip6/redirect.t.json.output +70 -0
73 lines not on this page · raw message
tests/shell/testcases/cache/dumps/0002_interval_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/chains/dumps/netdev_chain_dormant_autoremove.json-nft +3 -1
@@ -12,7 +12,9 @@ "family": "netdev", "name": "test", "handle": 0, - "flags": "dormant" + "flags": [ + "dormant" + ] } }, {
tests/shell/testcases/json/dumps/0001set_statements_0.json-nft +3 -1
@@ -34,7 +34,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/json/single_flag +24 -24
102 lines not on this page · raw message
tests/shell/testcases/listing/dumps/0010sets_0.json-nft +6 -2
@@ -62,7 +62,9 @@ "table": "test_arp", "type": "inet_service", "handle": 0, - "flags": "constant" + "flags": [ + "constant" + ] } }, {
@@ -104,7 +106,9 @@ "table": "filter", "type": "inet_service", "handle": 0, - "flags": "constant" + "flags": [ + "constant" + ] } }, {
tests/shell/testcases/listing/dumps/0012sets_0.json-nft +6 -2
@@ -62,7 +62,9 @@ "table": "test_arp", "type": "inet_service", "handle": 0, - "flags": "constant" + "flags": [ + "constant" + ] } }, {
@@ -104,7 +106,9 @@ "table": "filter", "type": "inet_service", "handle": 0, - "flags": "constant" + "flags": [ + "constant" + ] } }, {
tests/shell/testcases/listing/dumps/0022terse_0.json-nft +3 -1
@@ -33,7 +33,9 @@ "table": "filter", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "10.10.10.10", "10.10.11.11"
tests/shell/testcases/maps/dumps/0005interval_map_add_many_elements_0.json-nft +3 -1
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "map": "ipv4_addr", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/0006interval_map_overlap_0.json-nft +3 -1
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "map": "ipv4_addr", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/0008interval_map_delete_0.json-nft +3 -1
@@ -34,7 +34,9 @@ "type": "ipv4_addr", "handle": 0, "map": "mark", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ "127.0.0.2",
tests/shell/testcases/maps/dumps/0012map_concat_0.json-nft +3 -1
@@ -50,7 +50,9 @@ }, "handle": 0, "map": "verdict", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/0013map_0.json-nft +3 -1
@@ -38,7 +38,9 @@ ], "handle": 0, "map": "verdict", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/delete_element.json-nft +3 -1
@@ -40,7 +40,9 @@ }, "handle": 0, "map": "classid", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/delete_element_catchall.json-nft +3 -1
@@ -40,7 +40,9 @@ }, "handle": 0, "map": "classid", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ "*",
tests/shell/testcases/maps/dumps/map_with_flags_0.json-nft +3 -1
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "map": "ipv4_addr", - "flags": "timeout" + "flags": [ + "timeout" + ] } } ]
tests/shell/testcases/maps/dumps/named_ct_objects.json-nft +6 -2
@@ -111,7 +111,9 @@ }, "handle": 0, "map": "ct expectation", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
@@ -140,7 +142,9 @@ }, "handle": 0, "map": "ct helper", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/named_limits.json-nft +6 -2
@@ -144,7 +144,9 @@ }, "handle": 0, "map": "limit", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
@@ -284,7 +286,9 @@ }, "handle": 0, "map": "limit", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/pipapo_double_flush.json-nft +3 -1
@@ -33,7 +33,9 @@ ], "handle": 0, "map": "verdict", - "flags": "interval" + "flags": [ + "interval" + ] } } ]
tests/shell/testcases/maps/dumps/typeof_integer_0.json-nft +3 -1
@@ -48,7 +48,9 @@ }, "handle": 0, "map": "verdict", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/maps/dumps/typeof_maps_add_delete.json-nft +3 -1
@@ -50,7 +50,9 @@ "handle": 0, "map": "mark", "size": 64, - "flags": "timeout", + "flags": [ + "timeout" + ], "timeout": 300, "stmt": [ {
tests/shell/testcases/maps/dumps/typeof_maps_update_0.json-nft +6 -2
@@ -39,7 +39,9 @@ "handle": 0, "map": "mark", "size": 65535, - "flags": "timeout", + "flags": [ + "timeout" + ], "timeout": 360 } },
@@ -59,7 +61,9 @@ "handle": 0, "map": "mark", "size": 65535, - "flags": "timeout", + "flags": [ + "timeout" + ], "timeout": 60 } },
tests/shell/testcases/maps/dumps/vmap_timeout.json-nft +6 -2
@@ -66,7 +66,9 @@ "type": "inet_service", "handle": 0, "map": "verdict", - "flags": "timeout", + "flags": [ + "timeout" + ], "gc-interval": 10, "elem": [ [
@@ -105,7 +107,9 @@ }, "handle": 0, "map": "verdict", - "flags": "timeout", + "flags": [ + "timeout" + ], "gc-interval": 10, "elem": [ [
tests/shell/testcases/maps/dumps/vmap_unary.json-nft +3 -1
@@ -51,7 +51,9 @@ }, "handle": 0, "map": "verdict", - "flags": "interval" + "flags": [ + "interval" + ] } }, {
tests/shell/testcases/nft-f/dumps/0012different_defines_0.json-nft +6 -2
@@ -529,7 +529,9 @@ { "queue": { "num": 0, - "flags": "bypass" + "flags": [ + "bypass" + ] } } ]
@@ -768,7 +770,9 @@ } } }, - "flags": "bypass" + "flags": [ + "bypass" + ] } } ]
tests/shell/testcases/nft-f/dumps/0025empty_dynset_0.json-nft +9 -3
@@ -27,7 +27,9 @@ "inet_service" ], "handle": 0, - "flags": "dynamic", + "flags": [ + "dynamic" + ], "elem": [ { "elem": {
@@ -62,7 +64,9 @@ "inet_service" ], "handle": 0, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
@@ -78,7 +82,9 @@ "inet_service" ], "handle": 0, - "flags": "dynamic", + "flags": [ + "dynamic" + ], "elem": [ { "elem": {
tests/shell/testcases/nft-i/dumps/set_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "foo", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "10.1.1.1", "10.1.1.2"
tests/shell/testcases/optimizations/dumps/merge_vmaps.json-nft +3 -1
@@ -46,7 +46,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/optimizations/dumps/skip_unsupported.json-nft +3 -1
@@ -29,7 +29,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/packetpath/dumps/set_lookups.json-nft +6 -2
@@ -36,7 +36,9 @@ "iface_index" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
@@ -111,7 +113,9 @@ "table": "t", "type": "iface_index", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "lo" ]
tests/shell/testcases/rule_management/dumps/0004replace_0.json-nft +3 -1
@@ -38,7 +38,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval" + "flags": [ + "interval" + ] } }, {
tests/shell/testcases/rule_management/dumps/0011reset_0.json-nft +3 -1
@@ -38,7 +38,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic", + "flags": [ + "dynamic" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0001named_interval_0.json-nft +12 -4
@@ -29,7 +29,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "range": [
@@ -53,7 +55,9 @@ "table": "t", "type": "ipv6_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
@@ -77,7 +81,9 @@ "table": "t", "type": "inet_proto", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "range": [
@@ -101,7 +107,9 @@ "table": "t", "type": "inet_service", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "range": [
tests/shell/testcases/sets/dumps/0002named_interval_automerging_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0004named_interval_shadow_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv6_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0005named_interval_shadow_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv6_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0008comments_interval_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0009comments_timeout_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "timeout", + "flags": [ + "timeout" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0015rulesetflush_0.json-nft +3 -1
@@ -36,7 +36,9 @@ "table": "filter", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0022type_selective_flush_0.json-nft +3 -1
@@ -49,7 +49,9 @@ "type": "ipv4_addr", "handle": 0, "size": 1024, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/0024synproxy_0.json-nft +3 -1
@@ -58,7 +58,9 @@ "type": "ipv4_addr", "handle": 0, "map": "synproxy", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/sets/dumps/0027ipv6_maps_ipv4_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv6_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0028autoselect_0.json-nft +9 -3
@@ -34,7 +34,9 @@ "type": "inet_proto", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
@@ -45,7 +47,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
@@ -56,7 +60,9 @@ "type": "ipv4_addr", "handle": 0, "size": 1024, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/0028delete_handle_0.json-nft +3 -1
@@ -30,7 +30,9 @@ "table": "test-ip", "type": "inet_service", "handle": 0, - "flags": "timeout", + "flags": [ + "timeout" + ], "timeout": 10845 } },
tests/shell/testcases/sets/dumps/0032restore_set_simple_0.json-nft +6 -2
@@ -25,7 +25,9 @@ "ipv4_addr" ], "handle": 0, - "flags": "timeout" + "flags": [ + "timeout" + ] } }, {
@@ -38,7 +40,9 @@ "inet_service" ], "handle": 0, - "flags": "timeout" + "flags": [ + "timeout" + ] } } ]
tests/shell/testcases/sets/dumps/0033add_set_simple_flat_0.json-nft +6 -2
@@ -25,7 +25,9 @@ "ipv4_addr" ], "handle": 0, - "flags": "timeout" + "flags": [ + "timeout" + ] } }, {
@@ -38,7 +40,9 @@ "inet_service" ], "handle": 0, - "flags": "timeout" + "flags": [ + "timeout" + ] } } ]
tests/shell/testcases/sets/dumps/0034get_element_0.json-nft +9 -3
@@ -21,7 +21,9 @@ "table": "t", "type": "inet_service", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ 10, {
@@ -47,7 +49,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "10.0.0.1", {
@@ -87,7 +91,9 @@ "inet_service" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
tests/shell/testcases/sets/dumps/0035add_set_elements_flat_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval" + "flags": [ + "interval" + ] } } ]
tests/shell/testcases/sets/dumps/0038meter_list_0.json-nft +3 -1
@@ -44,7 +44,9 @@ "type": "ipv4_addr", "handle": 0, "size": 128, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/0039delete_interval_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "range": [
tests/shell/testcases/sets/dumps/0040get_host_endian_elements_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "mark", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "range": [
tests/shell/testcases/sets/dumps/0041interval_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "192.168.2.196" ]
tests/shell/testcases/sets/dumps/0042update_set_0.json-nft +3 -1
@@ -39,7 +39,9 @@ "type": "ether_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/0043concatenated_ranges_1.json-nft +6 -2
@@ -24,7 +24,9 @@ "ipv6_addr" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
@@ -1582,7 +1584,9 @@ "ipv4_addr" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
tests/shell/testcases/sets/dumps/0044interval_overlap_1.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "inet_service", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ 25, 30,
tests/shell/testcases/sets/dumps/0046netmap_0.json-nft +12 -4
@@ -92,8 +92,12 @@ } } }, - "flags": "netmap", - "type_flags": "prefix" + "flags": [ + "netmap" + ], + "type_flags": [ + "prefix" + ] } } ]
@@ -156,8 +160,12 @@ } } }, - "flags": "netmap", - "type_flags": "prefix" + "flags": [ + "netmap" + ], + "type_flags": [ + "prefix" + ] } } ]
tests/shell/testcases/sets/dumps/0049set_define_0.json-nft +3 -1
@@ -33,7 +33,9 @@ "table": "filter", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "auto-merge": true, "elem": [ "1.1.1.1"
tests/shell/testcases/sets/dumps/0051set_interval_counter_0.json-nft +3 -1
@@ -33,7 +33,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0052overlap_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "filter", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "auto-merge": true, "elem": [ "10.10.10.10",
tests/shell/testcases/sets/dumps/0054comments_set_0.json-nft +6 -2
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "comment": "test", - "flags": "interval" + "flags": [ + "interval" + ] } }, {
@@ -34,7 +36,9 @@ "handle": 0, "comment": "another test", "map": "ipv4_addr", - "flags": "interval" + "flags": [ + "interval" + ] } } ]
tests/shell/testcases/sets/dumps/0055tcpflags_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "test", "type": "tcp_flag", "handle": 0, - "flags": "constant", + "flags": [ + "constant" + ], "elem": [ { "|": [
tests/shell/testcases/sets/dumps/0060set_multistmt_1.json-nft +3 -1
@@ -34,7 +34,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic", + "flags": [ + "dynamic" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0062set_connlimit_0.json-nft +6 -2
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
@@ -33,7 +35,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic", + "flags": [ + "dynamic" + ], "stmt": [ { "ct count": {
tests/shell/testcases/sets/dumps/0063set_catchall_0.json-nft +3 -1
@@ -55,7 +55,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/0064map_catchall_0.json-nft +3 -1
@@ -50,7 +50,9 @@ "type": "ipv4_addr", "handle": 0, "map": "ipv4_addr", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/sets/dumps/0069interval_merge_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "auto-merge": true, "elem": [ {
tests/shell/testcases/sets/dumps/0071unclosed_prefix_interval_0.json-nft +6 -2
@@ -29,7 +29,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
@@ -53,7 +55,9 @@ "table": "t", "type": "ipv6_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/0073flat_interval_set.json-nft +3 -1
@@ -32,7 +32,9 @@ "type": "ipv4_addr", "handle": 0, "map": "counter", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/sets/dumps/0074nested_interval_set.json-nft +3 -1
@@ -32,7 +32,9 @@ "type": "ipv4_addr", "handle": 0, "map": "counter", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ {
tests/shell/testcases/sets/dumps/concat_interval_0.json-nft +6 -2
@@ -25,7 +25,9 @@ "inet_service" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "stmt": [ { "counter": null
@@ -43,7 +45,9 @@ "mark" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
tests/shell/testcases/sets/dumps/concat_nlmsg_overrun.json-nft +3 -1
@@ -25,7 +25,9 @@ "ipv4_addr" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "elem": {
tests/shell/testcases/sets/dumps/dynset_missing.json-nft +3 -1
@@ -34,7 +34,9 @@ "type": "ipv4_addr", "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/exact_overlap_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/sets/dumps/inner_0.json-nft +3 -1
@@ -74,7 +74,9 @@ }, "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/interval_size.json-nft +6 -2
@@ -29,7 +29,9 @@ }, "handle": 0, "size": 1, - "flags": "interval", + "flags": [ + "interval" + ], "auto-merge": true, "elem": [ {
@@ -56,7 +58,9 @@ }, "handle": 0, "size": 1, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "0.0.0.0" ]
tests/shell/testcases/sets/dumps/meter_set_reuse.json-nft +3 -1
@@ -33,7 +33,9 @@ ], "handle": 0, "size": 65535, - "flags": "dynamic" + "flags": [ + "dynamic" + ] } }, {
tests/shell/testcases/sets/dumps/range_with_same_start_end.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "t", "type": "inet_service", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ 10, 30,
tests/shell/testcases/sets/dumps/set_element_timeout_updates.json-nft +3 -1
@@ -40,7 +40,9 @@ } }, "handle": 0, - "flags": "timeout", + "flags": [ + "timeout" + ], "timeout": 60 } }
tests/shell/testcases/sets/dumps/set_eval_0.json-nft +3 -1
@@ -33,7 +33,9 @@ "table": "nat", "type": "ipv4_addr", "handle": 0, - "flags": "interval" + "flags": [ + "interval" + ] } }, {
tests/shell/testcases/sets/dumps/sets_with_ifnames.json-nft +9 -3
@@ -71,7 +71,9 @@ "table": "testifsets", "type": "ifname", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ "abcdef*", "othername",
@@ -115,7 +117,9 @@ "ifname" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
@@ -162,7 +166,9 @@ "type": "ifname", "handle": 0, "map": "verdict", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ "abcdef*",
tests/shell/testcases/sets/dumps/typeof_sets_concat.json-nft +3 -1
@@ -199,7 +199,9 @@ }, "handle": 0, "size": 16, - "flags": "interval" + "flags": [ + "interval" + ] } }, {
tests/shell/testcases/transactions/dumps/0002table_0.json-nft +3 -1
@@ -12,7 +12,9 @@ "family": "ip", "name": "x", "handle": 0, - "flags": "dormant" + "flags": [ + "dormant" + ] } }, {
tests/shell/testcases/transactions/dumps/0037set_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval" + "flags": [ + "interval" + ] } } ]
tests/shell/testcases/transactions/dumps/0038set_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/transactions/dumps/0039set_0.json-nft +3 -1
@@ -21,7 +21,9 @@ "table": "x", "type": "ipv4_addr", "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "prefix": {
tests/shell/testcases/transactions/dumps/0047set_0.json-nft +3 -1
@@ -22,7 +22,9 @@ "type": "ipv4_addr", "handle": 0, "map": "classid", - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ [ "10.1.26.2",
tests/shell/testcases/transactions/dumps/doubled-set.json-nft +3 -1
@@ -24,7 +24,9 @@ "ifname" ], "handle": 0, - "flags": "interval", + "flags": [ + "interval" + ], "elem": [ { "concat": [
tests/shell/testcases/transactions/dumps/table_onoff.json-nft +3 -1
@@ -12,7 +12,9 @@ "family": "ip", "name": "t", "handle": 0, - "flags": "dormant" + "flags": [ + "dormant" + ] } }, {
Signature · 1 line
2.49.0
Quoted 7 lines · Phil Sutter
This series consists of noise (patches 1-13 and most of patch 14) with a bit of signal in patch 14. This is because the relatively simple adjustment to JSON output requires minor adjustments to many stored JSON dumps in shell test suite and stored JSON output in py test suite. While doing this, I noticed some dups and stale entries in py test suite. To clean things up first, I ran
tests/py/tools/test-sanitizer.sh, fixed the warnings and sorted the changes into fixes for the respective commits.
I will follow up with a patch to partially revert the fib check change for JSON too.
Phil Sutter
reviewerQuoted 10 lines · Pablo Neira Ayuso
Quoted 7 lines · Phil Sutter
This series consists of noise (patches 1-13 and most of patch 14) with a bit of signal in patch 14. This is because the relatively simple adjustment to JSON output requires minor adjustments to many stored JSON dumps in shell test suite and stored JSON output in py test suite. While doing this, I noticed some dups and stale entries in py test suite. To clean things up first, I ran
tests/py/tools/test-sanitizer.sh, fixed the warnings and sorted the changes into fixes for the respective commits.Reviewed-by Pablo Neira Ayuso <[email protected]>
Series applied, thanks!
Quoted 2 lines
I will follow up with a patch to partially revert the fib check change for JSON too.
Hmm. That one seems like a sensible change and not just a simplification of output. I guess if we take this approach seriously, we should agree on (and communicate) an upgrade path for JSON output. In detail (from the top of my head):
1) What changes are considered compatible (and which not)
2) In which situations are incompatible changes acceptable
3) How to inform users of the incompatible change
I'd suggest something like:
1) Additions only, no changes of property values or names
2) Critical bug fixes or new (major?) versions
3) Bump JSON_SCHEMA_VERSION? Or is the "version" property in "metainfo" sufficient if bumped anyway?
Cheers, Phil
Pablo Neira Ayuso
maintainerQuoted 12 lines · Phil Sutter
Quoted 10 lines · Pablo Neira Ayuso
Quoted 7 lines · Phil Sutter
This series consists of noise (patches 1-13 and most of patch 14) with a bit of signal in patch 14. This is because the relatively simple adjustment to JSON output requires minor adjustments to many stored JSON dumps in shell test suite and stored JSON output in py test suite. While doing this, I noticed some dups and stale entries in py test suite. To clean things up first, I ran
tests/py/tools/test-sanitizer.sh, fixed the warnings and sorted the changes into fixes for the respective commits.Reviewed-by Pablo Neira Ayuso <[email protected]>
Quoted 7 lines
Series applied, thanks!
Quoted 2 lines
I will follow up with a patch to partially revert the fib check change for JSON too.
Hmm. That one seems like a sensible change and not just a simplification of output.
Actually, I don't find an easy way to retain backward compatibility in the JSON output for fib without reverting:
commit 525b58568dca5ab9998595fc45313eac2764b6b1
Author: Pablo Neira Ayuso <[email protected]> Date: Tue Jun 24 18:11:10 2025 +0200
fib: allow to use it in set statements
commit f4b646032acff4d743ad4f734aaca68e9264bdbb
Author: Pablo Neira Ayuso <[email protected]> Date: Tue Jun 24 18:11:06 2025 +0200
fib: allow to check if route exists in maps
I am not sure I want to do that, because then the fib expression cannot be used with sets/maps.
The "check" trick was a "smart" workaround, I don't have a way to know if you want to check for the presence of the real oif, without peeking on the relational right hand side, which only works for rules without set/map.
Peeking on the right hand side does not work to decide the semantics of the right hand side for relationals, but not for set and maps, because those could be empty, hence this "check" field.
Maybe, simply retain backward compatibility for the fib check with relational expression would do the trick? But I am not sure the JSON parser provides context on whether the expression is being used in a relational.
Quoted 8 lines
I guess if we take this approach seriously, we should agree on (and communicate) an upgrade path for JSON output. In detail (from the top of my head):
1) What changes are considered compatible (and which not)
2) In which situations are incompatible changes acceptable
3) How to inform users of the incompatible change
Quoted 6 lines
I'd suggest something like:
1) Additions only, no changes of property values or names
2) Critical bug fixes or new (major?) versions
3) BumpJSON_SCHEMA_VERSION? Or is the "version" property in "metainfo" sufficient if bumped anyway?
This was going to be an issue sooner or later.
Updating the JSON representation would require to maintain backward compatibility, changes would need to happen in a less incremental way because you don't want to change the schema so often.
And this would also require to extend tests/ to deal with the different versions? Which is going to be very tricky, it sounds like a no-go.
Then all this means that everything is set in stone for third party parsers, and that we have to forget the idea the JSON representation can be incrementally refined, and simply add more stuff on top of it as you suggest.
Pablo Neira Ayuso
maintainerQuoted 30 lines · Pablo Neira Ayuso
Quoted 12 lines · Phil Sutter
Quoted 10 lines · Pablo Neira Ayuso
Quoted 7 lines · Phil Sutter
This series consists of noise (patches 1-13 and most of patch 14) with a bit of signal in patch 14. This is because the relatively simple adjustment to JSON output requires minor adjustments to many stored JSON dumps in shell test suite and stored JSON output in py test suite. While doing this, I noticed some dups and stale entries in py test suite. To clean things up first, I ran
tests/py/tools/test-sanitizer.sh, fixed the warnings and sorted the changes into fixes for the respective commits.Reviewed-by Pablo Neira Ayuso <[email protected]>Quoted 7 lines
Series applied, thanks!
Quoted 2 lines
I will follow up with a patch to partially revert the fib check change for JSON too.
Hmm. That one seems like a sensible change and not just a simplification of output.
Actually, I don't find an easy way to retain backward compatibility in the JSON output for fib without reverting:
commit
525b58568dca5ab9998595fc45313eac2764b6b1Author: Pablo Neira Ayuso <[email protected]> Date: Tue Jun 24 18:11:10 2025 +0200fib: allow to use it in set statements
Quoted 8 lines
commit
f4b646032acff4d743ad4f734aaca68e9264bdbbAuthor: Pablo Neira Ayuso <[email protected]> Date: Tue Jun 24 18:11:06 2025 +0200fib: allow to check if route exists in maps
I am not sure I want to do that, because then the fib expression cannot be used with sets/maps.
I found a way, it is not "nice" but it helps to address the current issue:
https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/