summaryrefslogtreecommitdiffstats
path: root/tests/shell
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-08-09 22:45:21 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2022-08-11 16:23:15 +0200
commit7526881a6bbf874c0998fc9cea1646b5354596ce (patch)
tree94548a652534b207486a0ce57042fdf23691cc55 /tests/shell
parent2fec3ccb17d005b390598dca7837d17613d56d63 (diff)
optimize: check for mergeable rulesHEADmaster
Rules that are equal need to have at least one mergeable statement. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell')
-rw-r--r--tests/shell/testcases/optimizations/dumps/not_mergeable.nft12
-rwxr-xr-xtests/shell/testcases/optimizations/not_mergeable16
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/shell/testcases/optimizations/dumps/not_mergeable.nft b/tests/shell/testcases/optimizations/dumps/not_mergeable.nft
new file mode 100644
index 00000000..08b2b58f
--- /dev/null
+++ b/tests/shell/testcases/optimizations/dumps/not_mergeable.nft
@@ -0,0 +1,12 @@
+table ip x {
+ chain t1 {
+ }
+
+ chain t2 {
+ }
+
+ chain y {
+ counter packets 0 bytes 0 jump t1
+ counter packets 0 bytes 0 jump t2
+ }
+}
diff --git a/tests/shell/testcases/optimizations/not_mergeable b/tests/shell/testcases/optimizations/not_mergeable
new file mode 100755
index 00000000..25635cdd
--- /dev/null
+++ b/tests/shell/testcases/optimizations/not_mergeable
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+RULESET="table ip x {
+ chain t1 {
+ }
+ chain t2 {
+ }
+ chain y {
+ counter jump t1
+ counter jump t2
+ }
+}"
+
+$NFT -o -f - <<< $RULESET