diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-08-09 22:45:21 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-08-11 16:23:15 +0200 |
commit | 7526881a6bbf874c0998fc9cea1646b5354596ce (patch) | |
tree | 94548a652534b207486a0ce57042fdf23691cc55 /tests/shell | |
parent | 2fec3ccb17d005b390598dca7837d17613d56d63 (diff) |
optimize: check for mergeable rules
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.nft | 12 | ||||
-rwxr-xr-x | tests/shell/testcases/optimizations/not_mergeable | 16 |
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 |