Skip to contentSkip to conversation

update tests/shell for 5.4 kernels

PATCH In review Pablo Neira Ayuso 3 participants 22 messages Nov 9, 2023

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

cover update tests/shell for 5.4 kernels

Hi,

This is still not complete, still 8 tests/shell fail in 5.4 related to flowtable features that are missing, but this batch is already getting large.

This is the series:

1) export DIFF so it can be used from feature scripts.
2) Detect if pipapo set backend is present.
3) Detect if reject from prerouting chain support is present.
4) Detect if stateful expression in sets is supported.
5) Detect if NAT netmap support is present.
6) Detect if multidevice netdev chain support is present.
7) Split several tests not to lose coverage, usually those containing set intervals and set intervals with concatenations (pipapo). It is a bit of sledgehammer solution but for tests/shell I think it is fine.

I can follow up with a more complete series contains all feature detection for 5.4 or apply incrementally, just let me know.

Thanks.

Pablo Neira Ayuso (12):
tests: shell: export DIFF to use it from feature scripts
tests: shell: skip pipapo tests if kernel lacks support
tests: shell: skip prerouting reject tests if kernel lacks support
tests: shell: skip stateful expression in sets tests if kernel lacks support
tests: shell: skip NAT netmap tests if kernel lacks support
tests: shell: skip comment tests if kernel lacks support
tests: shell: skip multidevice chain tests if kernel lacks support
tests: shell: skip if kernel does not support bitshift
tests: shell: split set NAT interval test
tests: shell: split map test
tests: shell: split single element in anonymous set
tests: shell: split merge nat optimization in two tests

 tests/shell/features/comment.sh               | 11 +++
 .../features/netdev_chain_multidevice.sh      | 14 +++
 tests/shell/features/netmap.nft               |  8 ++
 tests/shell/features/pipapo.nft               |  9 ++
 tests/shell/features/prerouting_reject.nft    |  8 ++
 tests/shell/features/set_expr.sh              | 19 ++++
 tests/shell/run-tests.sh                      | 11 +--
 .../testcases/chains/0042chain_variable_0     |  2 +
 tests/shell/testcases/json/0002table_map_0    |  1 +
 tests/shell/testcases/json/0006obj_comment_0  |  1 +
 tests/shell/testcases/maps/0009vmap_0         |  2 +
 tests/shell/testcases/maps/0012map_0          | 19 ----
 tests/shell/testcases/maps/0012map_concat_0   | 24 ++++++
 tests/shell/testcases/maps/0013map_0          |  2 +
 tests/shell/testcases/maps/anon_objmap_concat |  2 +
 .../shell/testcases/maps/dumps/0012map_0.nft  | 13 ---
 .../testcases/maps/dumps/0012map_concat_0.nft | 14 +++
 tests/shell/testcases/maps/typeof_integer_0   |  2 +
 .../shell/testcases/maps/vmap_mark_bitwise_0  |  2 +
 .../optimizations/dumps/merge_nat.nft         |  8 --
 .../optimizations/dumps/merge_nat_concat.nft  |  8 ++
 .../optimizations/dumps/single_anon_set.nft   |  1 -
 .../dumps/single_anon_set_expr.nft            |  5 ++
 tests/shell/testcases/optimizations/merge_nat | 13 ---
 .../testcases/optimizations/merge_nat_concat  | 18 ++++
 .../optimizations/merge_stmts_concat          |  2 +
 .../testcases/optimizations/merge_stmts_vmap  |  2 +
 .../testcases/optimizations/merge_vmap_raw    |  2 +
 tests/shell/testcases/optimizations/ruleset   |  2 +
 .../testcases/optimizations/single_anon_set   |  3 -
 .../optimizations/single_anon_set_expr        | 26 ++++++
 .../testcases/optionals/comments_chain_0      |  2 +
 .../testcases/optionals/comments_objects_0    |  2 +
 .../testcases/optionals/comments_table_0      |  2 +
 tests/shell/testcases/sets/0020comments_0     |  2 +
 tests/shell/testcases/sets/0034get_element_0  |  2 +
 .../testcases/sets/0043concatenated_ranges_0  |  1 +
 .../testcases/sets/0043concatenated_ranges_1  |  2 +
 .../testcases/sets/0044interval_overlap_0     | 12 ++-
 tests/shell/testcases/sets/0046netmap_0       |  2 +
 tests/shell/testcases/sets/0047nat_0          |  2 +
 tests/shell/testcases/sets/0048set_counters_0 |  2 +
 .../testcases/sets/0051set_interval_counter_0 |  2 +
 .../testcases/sets/0067nat_concat_interval_0  | 17 +---
 tests/shell/testcases/sets/0067nat_interval_0 | 18 ++++
 tests/shell/testcases/sets/concat_interval_0  |  2 +
 .../sets/dumps/0067nat_concat_interval_0.nft  |  7 --
 .../sets/dumps/0067nat_interval_0.nft         | 12 +++
 tests/shell/testcases/sets/elem_opts_compat_0 |  2 +
 tests/shell/testcases/sets/typeof_sets_0      | 86 +++++++++----------
 50 files changed, 302 insertions(+), 129 deletions(-)
 create mode 100755 tests/shell/features/comment.sh
 create mode 100755 tests/shell/features/netdev_chain_multidevice.sh
 create mode 100644 tests/shell/features/netmap.nft
 create mode 100644 tests/shell/features/pipapo.nft
 create mode 100644 tests/shell/features/prerouting_reject.nft
 create mode 100755 tests/shell/features/set_expr.sh
 create mode 100755 tests/shell/testcases/maps/0012map_concat_0
 create mode 100644 tests/shell/testcases/maps/dumps/0012map_concat_0.nft
 create mode 100644 tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft
 create mode 100644 tests/shell/testcases/optimizations/dumps/single_anon_set_expr.nft
 create mode 100755 tests/shell/testcases/optimizations/merge_nat_concat
 create mode 100755 tests/shell/testcases/optimizations/single_anon_set_expr
 create mode 100755 tests/shell/testcases/sets/0067nat_interval_0
 create mode 100644 tests/shell/testcases/sets/dumps/0067nat_interval_0.nft
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/12 tests: shell: export DIFF to use it from feature scripts

export DIFF so it can be used from feature scripts to probe the kernel.

---
 tests/shell/run-tests.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
tests/shell/run-tests.sh +6 -5
index 27a0ec43042a..e51d51c9539b 100755
@@ -572,6 +572,12 @@ feature_probe()
 	return 1
 }
 
+DIFF="$(which diff)"
+if [ ! -x "$DIFF" ] ; then
+	DIFF=true
+fi
+export DIFF
+
 for feat in "${_HAVE_OPTS[@]}" ; do
 	var="NFT_TEST_HAVE_$feat"
 	if [ -z "${!var+x}" ] ; then
@@ -590,11 +596,6 @@ if [ "$NFT_TEST_JOBS" -eq 0 ] ; then
 	fi
 fi
 
-DIFF="$(which diff)"
-if [ ! -x "$DIFF" ] ; then
-	DIFF=true
-fi
-
 declare -A JOBS_PIDLIST
 
 _NFT_TEST_VALGRIND_VGDB_PREFIX=
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts

tests/shell/run-tests.sh feature_probe() · line 579

Quoted 8 lines · Pablo Neira Ayuso

export DIFF so it can be used from feature scripts to probe the kernel.

tests/shell/run-tests.sh +5 -0
+DIFF="$(which diff)"
+if [ ! -x "$DIFF" ] ; then
+	DIFF=true
+fi
+export DIFF

what is the purpose of having $DIFF variable at all? Why not require to have diff installed?

Maybe that justification is somewhere in the history of the project. If so, could you drop one line in the commit message what the point is?

Thomas

author maintainer
#3 lore raw

Re: [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts

Quoted 14 lines · Thomas Haller

tests/shell/run-tests.sh feature_probe() · line 579

Quoted 8 lines · Pablo Neira Ayuso

export DIFF so it can be used from feature scripts to probe the kernel.

tests/shell/run-tests.sh +5 -0
+DIFF="$(which diff)"
+if [ ! -x "$DIFF" ] ; then
+	DIFF=true
+fi
+export DIFF

what is the purpose of having $DIFF variable at all? Why not require to have diff installed?

Quoted 2 lines

Maybe that justification is somewhere in the history of the project. If so, could you drop one line in the commit message what the point is?

It is all available in git annotate:

68310ba0f9c2 ("tests: shell: Search diff tool once and for all") 7d93e2c2fbc7 ("tests: shell: autogenerate dump verification")

I just need to move it around so I can use it from feature scripts. If you prefer I can just use 'diff' instead from the feature scripts.

#4 lore raw

Re: [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts

Quoted 20 lines · Pablo Neira Ayuso
Quoted 14 lines · Thomas Haller

tests/shell/run-tests.sh feature_probe() · line 579

Quoted 8 lines · Pablo Neira Ayuso

export DIFF so it can be used from feature scripts to probe the kernel.

tests/shell/run-tests.sh +5 -0
+DIFF="$(which diff)"
+if [ ! -x "$DIFF" ] ; then
+	DIFF=true
+fi
+export DIFF

what is the purpose of having $DIFF variable at all? Why not require to have diff installed?

Quoted 4 lines

Maybe that justification is somewhere in the history of the project. If
so, could you drop one line in the commit message what the point is?

Quoted 4 lines

It is all available in git annotate:

68310ba0f9c2 ("tests: shell: Search diff tool once and for all") 7d93e2c2fbc7 ("tests: shell: autogenerate dump verification")

First use of $DIFF comes from

3fb3bb603374 ('tests/listing: add some listing tests')

which says:

In order to ease debug in case of failure, if the diff tool is in the system, then a textual diff is printed.

With the true fallback, checks are skipped. It would be possible, to use a fallback that still checks for equality (albeit without fancy diff output).

But really. Just require everybody to install a diff program.

Quoted 3 lines

I just need to move it around so I can use it from feature scripts. If you prefer I can just use 'diff' instead from the feature scripts.

Sure. The patch is fine.

I think one day,

   sed 's/\$DIFF\>/diff/g' -i $(git grep -l DIFF tests/shell/)

should be done.

Thomas

maintainer
#5 lore raw

Re: [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts

Quoted 5 lines · Thomas Haller

I think one day,

   sed 's/\$DIFF\>/diff/g' -i $(git grep -l DIFF tests/shell/)

should be done.

FWIW I agree with this.

maintainer
#6 lore raw

Re: [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts

In reply to Pablo Neira Ayuso
Quoted 2 lines · Pablo Neira Ayuso

I just need to move it around so I can use it from feature scripts. If you prefer I can just use 'diff' instead from the feature scripts.

Seems better to just use 'diff'.

author maintainer
#7 lore raw

PATCH 2/12 tests: shell: skip pipapo tests if kernel lacks support

In reply to Pablo Neira Ayuso

Skip tests that require net/netfilter/nft_set_pipapo support.

---
 tests/shell/features/pipapo.nft                      |  9 +++++++++
 tests/shell/testcases/maps/0013map_0                 |  2 ++
 tests/shell/testcases/maps/anon_objmap_concat        |  2 ++
 tests/shell/testcases/maps/typeof_integer_0          |  2 ++
 .../shell/testcases/optimizations/merge_stmts_concat |  2 ++
 tests/shell/testcases/optimizations/merge_vmap_raw   |  2 ++
 tests/shell/testcases/sets/0034get_element_0         |  2 ++
 tests/shell/testcases/sets/0043concatenated_ranges_0 |  1 +
 tests/shell/testcases/sets/0043concatenated_ranges_1 |  2 ++
 tests/shell/testcases/sets/0044interval_overlap_0    | 12 ++++++++++--
 tests/shell/testcases/sets/0047nat_0                 |  2 ++
 tests/shell/testcases/sets/concat_interval_0         |  2 ++
 12 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 tests/shell/features/pipapo.nft
tests/shell/features/pipapo.nft new file +9 -0
new file mode 100644
index 000000000000..17b56f2210d4
@@ -0,0 +1,9 @@
+# aaa31047a6d2 ("netfilter: nftables: add catch-all set element support")
+# v5.13-rc1~94^2~10^2~2
+table t {
+	set s {
+		type ipv4_addr . inet_service
+		flags interval
+		elements = { 1.1.1.1-2.2.2.2 . 80-90 }
+	}
+}
tests/shell/testcases/maps/0013map_0 +2 -0
index 70d7fd3b002f..c8d20cee7ca7 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 set -e
 
 RULESET="
tests/shell/testcases/maps/anon_objmap_concat +2 -0
index 07820b7c4fdd..34465f1da0be 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 set -e
 dumpfile=$(dirname $0)/dumps/$(basename $0).nft
 
tests/shell/testcases/maps/typeof_integer_0 +2 -0
index 0deff5eef67b..e93604e849c7 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 EXPECTED="table inet t {
 	map m1 {
 		typeof udp length . @ih,32,32 : verdict
tests/shell/testcases/optimizations/merge_stmts_concat +2 -0
index 9679d86223fd..4db4a6f90944 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 set -e
 
 RULESET="table ip x {
tests/shell/testcases/optimizations/merge_vmap_raw +2 -0
index f3dc0721b94f..eb04bec3ae69 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 set -e
 
 RULESET="table inet x {
tests/shell/testcases/sets/0034get_element_0 +2 -0
index 3343529b8ffa..32375b9f50c2 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 RC=0
 
 check() { # (set, elems, expected)
tests/shell/testcases/sets/0043concatenated_ranges_0 +1 -0
index 83d743503c7b..a3dbf5bf28ba 100755
@@ -1,5 +1,6 @@
 #!/bin/bash -e
 #
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
 # NFT_TEST_SKIP(NFT_TEST_SKIP_slow)
 #
 # 0043concatenated_ranges_0 - Add, get, list, timeout for concatenated ranges
tests/shell/testcases/sets/0043concatenated_ranges_1 +2 -0
index 1be2889352c9..bb3bf6b27ea7 100755
@@ -2,6 +2,8 @@
 #
 # 0043concatenated_ranges_1 - Insert and list subnets of different sizes
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 check() {
 	$NFT add element "${1}" t s "{ ${2} . ${3} }"
 	[ "$( $NFT list set "${1}" t s | grep -c "${2} . ${3}" )" = 1 ]
tests/shell/testcases/sets/0044interval_overlap_0 +10 -2
index 71bf3345a558..b0f51cc8873b 100755
@@ -117,7 +117,11 @@ add_elements() {
 	IFS='	
 '
 	for t in ${intervals_simple} switch ${intervals_concat}; do
+if [ "$NFT_TEST_HAVE_pipapo" = y ] ; then
 		[ "${t}" = "switch" ] && set="c"         && continue
+else
+		break
+fi
 		[ -z "${pass}" ]      && pass="${t}"     && continue
 		[ -z "${interval}" ]  && interval="${t}" && continue
 		unset IFS
@@ -148,7 +152,9 @@ add_elements() {
 
 $NFT add table t
 $NFT add set t s '{ type inet_service ; flags interval ; }'
-$NFT add set t c '{ type inet_service . inet_service ; flags interval ; }'
+if [ "$NFT_TEST_HAVE_pipapo" = y ] ; then
+	$NFT add set t c '{ type inet_service . inet_service ; flags interval ; }'
+fi
 add_elements
 
 $NFT flush ruleset
@@ -157,7 +163,9 @@ estimate_timeout
 $NFT flush ruleset
 $NFT add table t
 $NFT add set t s "{ type inet_service ; flags interval,timeout; timeout ${timeout}s; gc-interval ${timeout}s; }"
-$NFT add set t c "{ type inet_service . inet_service ; flags interval,timeout ; timeout ${timeout}s; gc-interval ${timeout}s; }"
+if [ "$NFT_TEST_HAVE_pipapo" = y ] ; then
+	$NFT add set t c "{ type inet_service . inet_service ; flags interval,timeout ; timeout ${timeout}s; gc-interval ${timeout}s; }"
+fi
 add_elements
 
 sleep $((timeout * 3 / 2))
tests/shell/testcases/sets/0047nat_0 +2 -0
index 4e53b7b8e8c8..757605ee3492 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 EXPECTED="table ip x {
             map y {
                     type ipv4_addr : interval ipv4_addr
tests/shell/testcases/sets/concat_interval_0 +2 -0
index 4d90af9a6557..36138ae0de78 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
 set -e
 
 RULESET="table ip t {
Signature · 1 line
2.30.2
maintainer
#8 lore raw

Re: [PATCH nft 02/12] tests: shell: skip pipapo tests if kernel lacks support

Quoted 25 lines · Pablo Neira Ayuso

Skip tests that require net/netfilter/nft_set_pipapo support.

---
 tests/shell/features/pipapo.nft                      |  9 +++++++++
 tests/shell/testcases/maps/0013map_0                 |  2 ++
 tests/shell/testcases/maps/anon_objmap_concat        |  2 ++
 tests/shell/testcases/maps/typeof_integer_0          |  2 ++
 .../shell/testcases/optimizations/merge_stmts_concat |  2 ++
 tests/shell/testcases/optimizations/merge_vmap_raw   |  2 ++
 tests/shell/testcases/sets/0034get_element_0         |  2 ++
 tests/shell/testcases/sets/0043concatenated_ranges_0 |  1 +
 tests/shell/testcases/sets/0043concatenated_ranges_1 |  2 ++
 tests/shell/testcases/sets/0044interval_overlap_0    | 12 ++++++++++--
 tests/shell/testcases/sets/0047nat_0                 |  2 ++
 tests/shell/testcases/sets/concat_interval_0         |  2 ++
 12 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 tests/shell/features/pipapo.nft
tests/shell/features/pipapo.nft new file +0 -0
new file mode 100644
index 000000000000..17b56f2210d4

tests/shell/features/pipapo.nft line 2

Quoted 2 lines
tests/shell/features/pipapo.nft new file +2 -0
@@ -0,0 +1,9 @@
+# aaa31047a6d2 ("netfilter: nftables: add catch-all set element support")
+# v5.13-rc1~94^2~10^2~2

# 3c4287f62044 ("nf_tables: Add set type for arbitrary concatenation of ranges") # v5.6-rc1~151^2~28^2~1

author maintainer
#9 lore raw

PATCH 3/12 tests: shell: skip prerouting reject tests if kernel lacks support

In reply to Pablo Neira Ayuso

Skip tests that require reject at prerouting hook.

---
 tests/shell/features/prerouting_reject.nft  | 8 ++++++++
 tests/shell/testcases/optimizations/ruleset | 2 ++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/shell/features/prerouting_reject.nft
tests/shell/features/prerouting_reject.nft new file +8 -0
new file mode 100644
index 000000000000..26098bb54534
@@ -0,0 +1,8 @@
+# f53b9b0bdc59 netfilter: introduce support for reject at prerouting stage
+# v5.13-rc1~94^2~10^2~2
+table inet t {
+	chain nat_filter {
+		type filter hook prerouting priority 0; policy accept;
+		reject with icmpx type host-unreachable
+	}
+}
tests/shell/testcases/optimizations/ruleset +2 -0
index ef2652dbeae8..2b2d80ffc009 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_prerouting_reject)
+
 RULESET="table inet uni {
 	chain gtfo {
 		reject with icmpx type host-unreachable
Signature · 1 line
2.30.2
maintainer
#10 lore raw

Re: [PATCH nft 03/12] tests: shell: skip prerouting reject tests if kernel lacks support

Quoted 15 lines · Pablo Neira Ayuso

Skip tests that require reject at prerouting hook.

---
 tests/shell/features/prerouting_reject.nft  | 8 ++++++++
 tests/shell/testcases/optimizations/ruleset | 2 ++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/shell/features/prerouting_reject.nft
tests/shell/features/prerouting_reject.nft new file +0 -0
new file mode 100644
index 000000000000..26098bb54534

tests/shell/features/prerouting_reject.nft line 2

Quoted 2 lines
tests/shell/features/prerouting_reject.nft new file +2 -0
@@ -0,0 +1,8 @@
+# f53b9b0bdc59 netfilter: introduce support for reject at prerouting stage
+# v5.13-rc1~94^2~10^2~2

# v5.9-rc1~133^2~302^2~11

author maintainer
#11 lore raw

PATCH 4/12 tests: shell: skip stateful expression in sets tests if kernel lacks support

In reply to Pablo Neira Ayuso

Skip tests that require stateful expressions in sets.

---
 tests/shell/features/set_expr.sh              | 19 +++++++++++++++++++
 tests/shell/testcases/json/0002table_map_0    |  1 +
 tests/shell/testcases/maps/0009vmap_0         |  2 ++
 .../testcases/optimizations/merge_stmts_vmap  |  2 ++
 tests/shell/testcases/sets/0048set_counters_0 |  2 ++
 .../testcases/sets/0051set_interval_counter_0 |  2 ++
 tests/shell/testcases/sets/elem_opts_compat_0 |  2 ++
 7 files changed, 30 insertions(+)
 create mode 100755 tests/shell/features/set_expr.sh
tests/shell/features/set_expr.sh new file +19 -0
new file mode 100755
index 000000000000..c323d59e8920
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# 65038428b2c6 ("netfilter: nf_tables: allow to specify stateful expression in set definition")
+# v5.6-rc5-1736-g65038428b2c6
+
+# NFT_SET_EXPR to detect kernel feature only available since
+# b4e70d8dd9ea ("netfilter: nftables: add set expression flags")
+# v5.10-11680-gb4e70d8dd9ea
+
+EXPECTED="table ip x {
+	set y {
+		typeof ip saddr
+		counter
+	}
+}"
+
+$NFT -f - <<< $EXPECTED
+
+$DIFF -u <($NFT list ruleset) - <<<"$EXPECTED"
tests/shell/testcases/json/0002table_map_0 +1 -0
index b375e9969608..a1e9f2634978 100755
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_json)
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
 
 set -e
 
tests/shell/testcases/maps/0009vmap_0 +2 -0
index d31e1608f792..4e133b72f6ef 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
 set -e
 
 EXPECTED="table inet filter {
tests/shell/testcases/optimizations/merge_stmts_vmap +2 -0
index 6e0f0762b7bb..e5357c0f66b6 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
 set -e
 
 RULESET="table ip x {
tests/shell/testcases/sets/0048set_counters_0 +2 -0
index e62d25df799c..95babdc9ca5f 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
 set -e
 
 EXPECTED="table ip x {
tests/shell/testcases/sets/0051set_interval_counter_0 +2 -0
index ea90e264bfcc..6e67a43c577a 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
 set -e
 
 EXPECTED="table ip x {
tests/shell/testcases/sets/elem_opts_compat_0 +2 -0
index 3467cc07e646..7563773e626f 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
 # ordering of element options and expressions has changed, make sure parser
 # accepts both ways
 
Signature · 1 line
2.30.2
maintainer
#12 lore raw

Re: [PATCH nft 04/12] tests: shell: skip stateful expression in sets tests if kernel lacks support

Quoted 20 lines · Pablo Neira Ayuso

Skip tests that require stateful expressions in sets.

---
 tests/shell/features/set_expr.sh              | 19 +++++++++++++++++++
 tests/shell/testcases/json/0002table_map_0    |  1 +
 tests/shell/testcases/maps/0009vmap_0         |  2 ++
 .../testcases/optimizations/merge_stmts_vmap  |  2 ++
 tests/shell/testcases/sets/0048set_counters_0 |  2 ++
 .../testcases/sets/0051set_interval_counter_0 |  2 ++
 tests/shell/testcases/sets/elem_opts_compat_0 |  2 ++
 7 files changed, 30 insertions(+)
 create mode 100755 tests/shell/features/set_expr.sh
tests/shell/features/set_expr.sh new file +0 -0
new file mode 100755
index 000000000000..c323d59e8920

tests/shell/features/set_expr.sh line 4

Quoted 4 lines
tests/shell/features/set_expr.sh new file +4 -0
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# 65038428b2c6 ("netfilter: nf_tables: allow to specify stateful expression in set definition")
+# v5.6-rc5-1736-g65038428b2c6

v5.7-rc1~146^2~12^2~25

(git-describe --contains).

author maintainer
#13 lore raw

PATCH 5/12 tests: shell: skip NAT netmap tests if kernel lacks support

In reply to Pablo Neira Ayuso

Skip tests that require NAT netmap support

---
 tests/shell/features/netmap.nft         | 8 ++++++++
 tests/shell/testcases/sets/0046netmap_0 | 2 ++
 2 files changed, 10 insertions(+)
 create mode 100644 tests/shell/features/netmap.nft
tests/shell/features/netmap.nft new file +8 -0
new file mode 100644
index 000000000000..129ee243e2eb
@@ -0,0 +1,8 @@
+# 3ff7ddb1353d ("netfilter: nft_nat: add netmap support")
+# v5.7-rc2-635-g3ff7ddb1353d
+table ip x {
+        chain y {
+              type nat hook postrouting priority srcnat; policy accept;
+              snat ip prefix to ip saddr map { 10.141.11.0/24 : 192.168.2.0/24 }
+        }
+}
tests/shell/testcases/sets/0046netmap_0 +2 -0
index 60bda4017c59..7533623e7f7b 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_netmap)
+
 EXPECTED="table ip x {
             chain y {
                     type nat hook postrouting priority srcnat; policy accept;
Signature · 1 line
2.30.2
author maintainer
#14 lore raw

PATCH 6/12 tests: shell: skip comment tests if kernel lacks support

In reply to Pablo Neira Ayuso

Skip tests that require comment support

---
 tests/shell/features/comment.sh                    | 11 +++++++++++
 tests/shell/testcases/json/0006obj_comment_0       |  1 +
 tests/shell/testcases/optionals/comments_chain_0   |  2 ++
 tests/shell/testcases/optionals/comments_objects_0 |  2 ++
 tests/shell/testcases/optionals/comments_table_0   |  2 ++
 tests/shell/testcases/sets/0020comments_0          |  2 ++
 6 files changed, 20 insertions(+)
 create mode 100755 tests/shell/features/comment.sh
tests/shell/features/comment.sh new file +11 -0
new file mode 100755
index 000000000000..516cf5e183ad
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+EXPECTED="table ip x {
+	chain y {
+		comment \"test\"
+	}
+}"
+
+$NFT -f - <<< $EXPECTED
+
+$DIFF -u <($NFT list ruleset) - <<<"$EXPECTED"
tests/shell/testcases/json/0006obj_comment_0 +1 -0
index 4c2a0e8c0880..7ce859d2529f 100755
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # NFT_TEST_REQUIRES(NFT_TEST_HAVE_json)
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment)
 
 set -e
 
tests/shell/testcases/optionals/comments_chain_0 +2 -0
index fba961c76841..1a84cfa67a2a 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment)
+
 EXPECTED='table ip test_table {
 	chain test_chain {
 		comment "test"
tests/shell/testcases/optionals/comments_objects_0 +2 -0
index 301f5518fb80..28041ebd2a43 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment)
+
 set -e
 
 COMMENT128="12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"
tests/shell/testcases/optionals/comments_table_0 +2 -0
index a0dfd7494661..56bb206bddcf 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment)
+
 # comments are shown
 
 $NFT add table test { comment \"test_comment\"\; }
tests/shell/testcases/sets/0020comments_0 +2 -0
index 44d451a8ad3a..1df38326ab57 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_comment)
+
 # Test that comments are added to set elements in standard sets.
 # Explicitly test bitmap backend set implementation.
 
Signature · 1 line
2.30.2
author maintainer
#15 lore raw

PATCH 7/12 tests: shell: skip multidevice chain tests if kernel lacks support

In reply to Pablo Neira Ayuso
---
 tests/shell/features/netdev_chain_multidevice.sh  | 14 ++++++++++++++
 tests/shell/testcases/chains/0042chain_variable_0 |  2 ++
 2 files changed, 16 insertions(+)
 create mode 100755 tests/shell/features/netdev_chain_multidevice.sh
tests/shell/features/netdev_chain_multidevice.sh new file +14 -0
new file mode 100755
index 000000000000..07f892035301
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+trap "ip link del d0; ip link del d1" EXIT
+
+ip link add d0 type dummy
+ip link add d1 type dummy
+
+EXPECTED="table netdev filter2 {
+        chain Main_Ingress2 {
+                type filter hook ingress devices = { \"d0\", \"d1\" } priority -500; policy accept;
+        }
+}"
+
+$NFT -f - <<< $EXPECTED
tests/shell/testcases/chains/0042chain_variable_0 +2 -0
index a4b929f7344c..c5de495ef074 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_netdev_chain_multidevice)
+
 set -e
 
 ip link add name d23456789012345 type dummy
Signature · 1 line
2.30.2
author maintainer
#16 lore raw

PATCH 8/12 tests: shell: skip if kernel does not support bitshift

In reply to Pablo Neira Ayuso

A few tests are missing bitshift checks that has been added to 885845468408 ("tests/shell: skip bitshift tests if kernel lacks support").

---
 .../shell/testcases/maps/vmap_mark_bitwise_0  |  2 +
 tests/shell/testcases/sets/typeof_sets_0      | 86 +++++++++----------
 2 files changed, 45 insertions(+), 43 deletions(-)
tests/shell/testcases/maps/vmap_mark_bitwise_0 +2 -0
index 0d933553e6b8..2f305b27bc33 100755
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_bitshift)
+
 set -e
 
 RULESET="table ip x {
tests/shell/testcases/sets/typeof_sets_0 +43 -43

162 lines not on this page · raw message

Signature · 1 line
2.30.2
author maintainer
#17 lore raw

PATCH 9/12 tests: shell: split set NAT interval test

In reply to Pablo Neira Ayuso

Split test in two, one for interval sets and another with concatenation
+ intervals, so at least intervals are tested in older kernels with no pipapo support.

---
 .../testcases/sets/0067nat_concat_interval_0   | 17 ++---------------
 tests/shell/testcases/sets/0067nat_interval_0  | 18 ++++++++++++++++++
 .../sets/dumps/0067nat_concat_interval_0.nft   |  7 -------
 .../sets/dumps/0067nat_interval_0.nft          | 12 ++++++++++++
 4 files changed, 32 insertions(+), 22 deletions(-)
 create mode 100755 tests/shell/testcases/sets/0067nat_interval_0
 create mode 100644 tests/shell/testcases/sets/dumps/0067nat_interval_0.nft
tests/shell/testcases/sets/0067nat_concat_interval_0 +2 -15
index 55cc0d4b43df..816219573870 100755
@@ -1,21 +1,8 @@
 #!/bin/bash
 
-set -e
-
-EXPECTED="table ip nat {
-       map ipportmap {
-                type ipv4_addr : interval ipv4_addr . inet_service
-                flags interval
-                elements = { 192.168.1.2 : 10.141.10.1-10.141.10.3 . 8888-8999 }
-       }
-       chain prerouting {
-                type nat hook prerouting priority dstnat; policy accept;
-                ip protocol tcp dnat ip to ip saddr map @ipportmap
-       }
-}"
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
 
-$NFT -f - <<< $EXPECTED
-$NFT add element ip nat ipportmap { 192.168.2.0/24 : 10.141.11.5-10.141.11.20 . 8888-8999 }
+set -e
 
 EXPECTED="table ip nat {
         map ipportmap2 {
tests/shell/testcases/sets/0067nat_interval_0 new file +18 -0
new file mode 100755
index 000000000000..c90203d0d648
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+EXPECTED="table ip nat {
+       map ipportmap {
+                type ipv4_addr : interval ipv4_addr . inet_service
+                flags interval
+                elements = { 192.168.1.2 : 10.141.10.1-10.141.10.3 . 8888-8999 }
+       }
+       chain prerouting {
+                type nat hook prerouting priority dstnat; policy accept;
+                ip protocol tcp dnat ip to ip saddr map @ipportmap
+       }
+}"
+
+$NFT -f - <<< $EXPECTED
+$NFT add element ip nat ipportmap { 192.168.2.0/24 : 10.141.11.5-10.141.11.20 . 8888-8999 }
tests/shell/testcases/sets/dumps/0067nat_concat_interval_0.nft +0 -7
index 0215691e28ee..9ac3774a7222 100644
@@ -1,10 +1,4 @@
 table ip nat {
-	map ipportmap {
-		type ipv4_addr : interval ipv4_addr . inet_service
-		flags interval
-		elements = { 192.168.1.2 : 10.141.10.1-10.141.10.3 . 8888-8999, 192.168.2.0/24 : 10.141.11.5-10.141.11.20 . 8888-8999 }
-	}
-
 	map ipportmap2 {
 		type ipv4_addr . ipv4_addr : interval ipv4_addr . inet_service
 		flags interval
@@ -33,7 +27,6 @@ table ip nat {
 
 	chain prerouting {
 		type nat hook prerouting priority dstnat; policy accept;
-		ip protocol tcp dnat ip to ip saddr map @ipportmap
 		ip protocol tcp dnat ip to ip saddr . ip daddr map @ipportmap2
 		meta l4proto { tcp, udp } dnat ip to ip daddr . th dport map @fwdtoip_th
 		dnat ip to iifname . ip saddr map @ipportmap4
tests/shell/testcases/sets/dumps/0067nat_interval_0.nft new file +12 -0
new file mode 100644
index 000000000000..b6d07fcdc248
@@ -0,0 +1,12 @@
+table ip nat {
+	map ipportmap {
+		type ipv4_addr : interval ipv4_addr . inet_service
+		flags interval
+		elements = { 192.168.1.2 : 10.141.10.1-10.141.10.3 . 8888-8999, 192.168.2.0/24 : 10.141.11.5-10.141.11.20 . 8888-8999 }
+	}
+
+	chain prerouting {
+		type nat hook prerouting priority dstnat; policy accept;
+		ip protocol tcp dnat ip to ip saddr map @ipportmap
+	}
+}
Signature · 1 line
2.30.2
author maintainer
#18 lore raw

PATCH 10/12 tests: shell: split map test

In reply to Pablo Neira Ayuso

Split interval + concatenation into a separated file, so older kernels with no pipapo can still run what it is supported.

---
 tests/shell/testcases/maps/0012map_0          | 19 ---------------
 tests/shell/testcases/maps/0012map_concat_0   | 24 +++++++++++++++++++
 .../shell/testcases/maps/dumps/0012map_0.nft  | 13 ----------
 .../testcases/maps/dumps/0012map_concat_0.nft | 14 +++++++++++
 4 files changed, 38 insertions(+), 32 deletions(-)
 create mode 100755 tests/shell/testcases/maps/0012map_concat_0
 create mode 100644 tests/shell/testcases/maps/dumps/0012map_concat_0.nft
tests/shell/testcases/maps/0012map_0 +0 -19
index 49e51b755b0f..dd93c482f441 100755
@@ -15,22 +15,3 @@ table ip x {
 }"
 
 $NFT -f - <<< "$EXPECTED"
-
-EXPECTED="table ip x {
-	map w {
-		typeof ip saddr . meta mark : verdict
-		flags interval
-		counter
-		elements = {
-			127.0.0.1-127.0.0.4 . 0x123434-0xb00122 : accept,
-		}
-	}
-
-	chain k {
-		type filter hook input priority filter + 1; policy accept;
-		meta mark set 0x123434
-		ip saddr . meta mark vmap @w
-	}
-}"
-
-$NFT -f - <<< "$EXPECTED"
tests/shell/testcases/maps/0012map_concat_0 new file +24 -0
new file mode 100755
index 000000000000..d18c7a73c844
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
+set -e
+
+EXPECTED="table ip x {
+        map w {
+                typeof ip saddr . meta mark : verdict
+                flags interval
+                counter
+                elements = {
+                        127.0.0.1-127.0.0.4 . 0x123434-0xb00122 : accept,
+                }
+        }
+
+        chain k {
+                type filter hook input priority filter + 1; policy accept;
+                meta mark set 0x123434
+                ip saddr . meta mark vmap @w
+        }
+}"
+
+$NFT -f - <<< "$EXPECTED"
tests/shell/testcases/maps/dumps/0012map_0.nft +0 -13
index 895490cffa8c..e734fc1c70b9 100644
@@ -6,20 +6,7 @@ table ip x {
 			     "eth1" : drop }
 	}
 
-	map w {
-		typeof ip saddr . meta mark : verdict
-		flags interval
-		counter
-		elements = { 127.0.0.1-127.0.0.4 . 0x00123434-0x00b00122 counter packets 0 bytes 0 : accept }
-	}
-
 	chain y {
 		iifname vmap { "lo" : accept, "eth0" : drop, "eth1" : drop }
 	}
-
-	chain k {
-		type filter hook input priority filter + 1; policy accept;
-		meta mark set 0x00123434
-		ip saddr . meta mark vmap @w
-	}
 }
tests/shell/testcases/maps/dumps/0012map_concat_0.nft new file +14 -0
new file mode 100644
index 000000000000..6649d0342a28
@@ -0,0 +1,14 @@
+table ip x {
+	map w {
+		typeof ip saddr . meta mark : verdict
+		flags interval
+		counter
+		elements = { 127.0.0.1-127.0.0.4 . 0x00123434-0x00b00122 counter packets 0 bytes 0 : accept }
+	}
+
+	chain k {
+		type filter hook input priority filter + 1; policy accept;
+		meta mark set 0x00123434
+		ip saddr . meta mark vmap @w
+	}
+}
Signature · 1 line
2.30.2
author maintainer
#19 lore raw

PATCH 11/12 tests: shell: split single element in anonymous set

In reply to Pablo Neira Ayuso

Split this to move set stateful expression support into a separated test not to harm existing coverage.

---
 .../optimizations/dumps/single_anon_set.nft   |  1 -
 .../dumps/single_anon_set_expr.nft            |  5 ++++
 .../testcases/optimizations/single_anon_set   |  3 ---
 .../optimizations/single_anon_set_expr        | 26 +++++++++++++++++++
 4 files changed, 31 insertions(+), 4 deletions(-)
 create mode 100644 tests/shell/testcases/optimizations/dumps/single_anon_set_expr.nft
 create mode 100755 tests/shell/testcases/optimizations/single_anon_set_expr
tests/shell/testcases/optimizations/dumps/single_anon_set.nft +0 -1
index 3f703034d80f..35e3f36e1a54 100644
@@ -11,6 +11,5 @@ table ip test {
 		ip daddr . tcp dport { 192.168.0.1 . 22 } accept
 		meta mark set ip daddr map { 192.168.0.1 : 0x00000001 }
 		ct state { established, related } accept
-		meta mark { 0x0000000a counter packets 0 bytes 0 }
 	}
 }
tests/shell/testcases/optimizations/dumps/single_anon_set_expr.nft new file +5 -0
new file mode 100644
index 000000000000..54880b927250
@@ -0,0 +1,5 @@
+table ip test {
+	chain test {
+		meta mark { 0x0000000a counter packets 0 bytes 0 }
+	}
+}
tests/shell/testcases/optimizations/single_anon_set +0 -3
index 84fc2a7f03a8..632e965f37a7 100755
@@ -46,9 +46,6 @@ table ip test {
 		# ct state cannot be both established and related
 		# at the same time, but this needs extra work.
 		ct state { established, related } accept
-
-		# with stateful statement
-		meta mark { 0x0000000a counter }
 	}
 }
 EOF
tests/shell/testcases/optimizations/single_anon_set_expr new file +26 -0
new file mode 100755
index 000000000000..81b7cebadd5d
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_set_expr)
+
+set -e
+
+test -d "$NFT_TEST_TESTTMPDIR"
+
+# Input file contains rules with anon sets that contain
+# one element, plus extra rule with two elements (that should be
+# left alone).
+
+# Dump file has the simplified rules where anon sets have been
+# replaced by equality tests where possible.
+file_input1="$NFT_TEST_TESTTMPDIR/input1.nft"
+
+cat <<EOF > "$file_input1"
+table ip test {
+	chain test {
+		# with stateful statement
+		meta mark { 0x0000000a counter }
+	}
+}
+EOF
+
+$NFT -f "$file_input1"
Signature · 1 line
2.30.2
author maintainer
#20 lore raw

PATCH 12/12 tests: shell: split merge nat optimization in two tests

In reply to Pablo Neira Ayuso

One without pipapo support and another with not to harm existing coverage.

---
 .../optimizations/dumps/merge_nat.nft          |  8 --------
 .../optimizations/dumps/merge_nat_concat.nft   |  8 ++++++++
 tests/shell/testcases/optimizations/merge_nat  | 13 -------------
 .../testcases/optimizations/merge_nat_concat   | 18 ++++++++++++++++++
 4 files changed, 26 insertions(+), 21 deletions(-)
 create mode 100644 tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft
 create mode 100755 tests/shell/testcases/optimizations/merge_nat_concat
tests/shell/testcases/optimizations/dumps/merge_nat.nft +0 -8
index 48d18a676ee0..61feb278d5e6 100644
@@ -11,14 +11,6 @@ table ip test2 {
 		ip saddr { 10.141.11.0/24, 10.141.13.0/24 } masquerade
 	}
 }
-table ip test3 {
-	chain y {
-		oif "lo" accept
-		snat to ip saddr . tcp sport map { 1.1.1.1 . 1024-65535 : 3.3.3.3, 2.2.2.2 . 1024-65535 : 4.4.4.4 }
-		oifname "enp2s0" snat ip to ip saddr map { 10.1.1.0/24 : 72.2.3.66-72.2.3.78 }
-		tcp dport { 8888, 9999 } redirect
-	}
-}
 table ip test4 {
 	chain y {
 		oif "lo" accept
tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft new file +8 -0
new file mode 100644
index 000000000000..0faddfd14fb8
@@ -0,0 +1,8 @@
+table ip test3 {
+	chain y {
+		oif "lo" accept
+		snat to ip saddr . tcp sport map { 1.1.1.1 . 1024-65535 : 3.3.3.3, 2.2.2.2 . 1024-65535 : 4.4.4.4 }
+		oifname "enp2s0" snat ip to ip saddr map { 10.1.1.0/24 : 72.2.3.66-72.2.3.78 }
+		tcp dport { 8888, 9999 } redirect
+	}
+}
tests/shell/testcases/optimizations/merge_nat +0 -13
index 3a57d9402301..bfe978701b90 100755
@@ -24,19 +24,6 @@ RULESET="table ip test2 {
 
 $NFT -o -f - <<< $RULESET
 
-RULESET="table ip test3 {
-        chain y {
-                oif lo accept
-                ip saddr 1.1.1.1 tcp sport 1024-65535 snat to 3.3.3.3
-                ip saddr 2.2.2.2 tcp sport 1024-65535 snat to 4.4.4.4
-                oifname enp2s0 snat ip to ip saddr map { 10.1.1.0/24 : 72.2.3.66-72.2.3.78 }
-                tcp dport 8888 redirect
-                tcp dport 9999 redirect
-        }
-}"
-
-$NFT -o -f - <<< $RULESET
-
 RULESET="table ip test4 {
         chain y {
                 oif lo accept
tests/shell/testcases/optimizations/merge_nat_concat new file +18 -0
new file mode 100755
index 000000000000..2e0a91a35bd6
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_pipapo)
+
+set -e
+
+RULESET="table ip test3 {
+        chain y {
+                oif lo accept
+                ip saddr 1.1.1.1 tcp sport 1024-65535 snat to 3.3.3.3
+                ip saddr 2.2.2.2 tcp sport 1024-65535 snat to 4.4.4.4
+                oifname enp2s0 snat ip to ip saddr map { 10.1.1.0/24 : 72.2.3.66-72.2.3.78 }
+                tcp dport 8888 redirect
+                tcp dport 9999 redirect
+        }
+}"
+
+$NFT -o -f - <<< $RULESET
Signature · 1 line
2.30.2
maintainer
#21 lore raw
In reply to Pablo Neira Ayuso
Quoted 4 lines · Pablo Neira Ayuso

Hi,

This is still not complete, still 8 tests/shell fail in 5.4 related to flowtable features that are missing, but this batch is already getting large.

Thats fine, you can push what you have.