]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: split merge nat optimization in two tests
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 7 Nov 2023 12:03:56 +0000 (13:03 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 11 Nov 2023 09:05:26 +0000 (10:05 +0100)
One without pipapo support and another with not to harm existing
coverage.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/optimizations/dumps/merge_nat.nft
tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft [new file with mode: 0644]
tests/shell/testcases/optimizations/merge_nat
tests/shell/testcases/optimizations/merge_nat_concat [new file with mode: 0755]

index 48d18a676ee0cc47f5ac510fc03548d38c474d07..61feb278d5e6c970b4b603ea8d7d48e3db96c716 100644 (file)
@@ -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
diff --git a/tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft b/tests/shell/testcases/optimizations/dumps/merge_nat_concat.nft
new file mode 100644 (file)
index 0000000..0faddfd
--- /dev/null
@@ -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
+       }
+}
index 3a57d9402301b7b9958c342cce8373cda180ccd5..bfe978701b90c0b6a37b5353f92fb54fddaad31e 100755 (executable)
@@ -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
diff --git a/tests/shell/testcases/optimizations/merge_nat_concat b/tests/shell/testcases/optimizations/merge_nat_concat
new file mode 100755 (executable)
index 0000000..2e0a91a
--- /dev/null
@@ -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