Add tests to validate setting marks with statement arguments that include binops with variable RHS operands. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- tests/shell/testcases/chains/0040mark_binop_10 | 11 +++++++++++ tests/shell/testcases/chains/0040mark_binop_11 | 11 +++++++++++ tests/shell/testcases/chains/0040mark_binop_12 | 11 +++++++++++ tests/shell/testcases/chains/0040mark_binop_13 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_0 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_1 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_2 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_3 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_4 | 11 +++++++++++ tests/shell/testcases/chains/0044payload_binop_5 | 11 +++++++++++ .../testcases/chains/dumps/0040mark_binop_10.nft | 6 ++++++ .../testcases/chains/dumps/0040mark_binop_11.nft | 6 ++++++ .../testcases/chains/dumps/0040mark_binop_12.nft | 6 ++++++ .../testcases/chains/dumps/0040mark_binop_13.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_0.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_1.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_2.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_3.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_4.nft | 6 ++++++ .../testcases/chains/dumps/0044payload_binop_5.nft | 6 ++++++ 20 files changed, 170 insertions(+) create mode 100755 tests/shell/testcases/chains/0040mark_binop_10 create mode 100755 tests/shell/testcases/chains/0040mark_binop_11 create mode 100755 tests/shell/testcases/chains/0040mark_binop_12 create mode 100755 tests/shell/testcases/chains/0040mark_binop_13 create mode 100755 tests/shell/testcases/chains/0044payload_binop_0 create mode 100755 tests/shell/testcases/chains/0044payload_binop_1 create mode 100755 tests/shell/testcases/chains/0044payload_binop_2 create mode 100755 tests/shell/testcases/chains/0044payload_binop_3 create mode 100755 tests/shell/testcases/chains/0044payload_binop_4 create mode 100755 tests/shell/testcases/chains/0044payload_binop_5 create mode 100644 tests/shell/testcases/chains/dumps/0040mark_binop_10.nft create mode 100644 tests/shell/testcases/chains/dumps/0040mark_binop_11.nft create mode 100644 tests/shell/testcases/chains/dumps/0040mark_binop_12.nft create mode 100644 tests/shell/testcases/chains/dumps/0040mark_binop_13.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_0.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_1.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_2.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_3.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_4.nft create mode 100644 tests/shell/testcases/chains/dumps/0044payload_binop_5.nft diff --git a/tests/shell/testcases/chains/0040mark_binop_10 b/tests/shell/testcases/chains/0040mark_binop_10 new file mode 100755 index 000000000000..8e9bc6ad4329 --- /dev/null +++ b/tests/shell/testcases/chains/0040mark_binop_10 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table t + add chain t c { type filter hook output priority filter; } + add rule t c ct mark set ct mark and 0xffff0000 or meta mark and 0xffff +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0040mark_binop_11 b/tests/shell/testcases/chains/0040mark_binop_11 new file mode 100755 index 000000000000..7825b0827851 --- /dev/null +++ b/tests/shell/testcases/chains/0040mark_binop_11 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table t + add chain t c { type filter hook input priority filter; } + add rule t c meta mark set ct mark and 0xffff0000 or meta mark and 0xffff +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0040mark_binop_12 b/tests/shell/testcases/chains/0040mark_binop_12 new file mode 100755 index 000000000000..aa27cdc5303c --- /dev/null +++ b/tests/shell/testcases/chains/0040mark_binop_12 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table ip6 t + add chain ip6 t c { type filter hook output priority filter; } + add rule ip6 t c ct mark set ct mark and 0xffff0000 or meta mark and 0xffff +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0040mark_binop_13 b/tests/shell/testcases/chains/0040mark_binop_13 new file mode 100755 index 000000000000..53a7e2ec6c6f --- /dev/null +++ b/tests/shell/testcases/chains/0040mark_binop_13 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table ip6 t + add chain ip6 t c { type filter hook input priority filter; } + add rule ip6 t c meta mark set ct mark and 0xffff0000 or meta mark and 0xffff +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_0 b/tests/shell/testcases/chains/0044payload_binop_0 new file mode 100755 index 000000000000..81b8cbaa961f --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_0 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table t + add chain t c { type filter hook output priority filter; } + add rule t c ip dscp set (ct mark & 0xfc000000) >> 26 +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_1 b/tests/shell/testcases/chains/0044payload_binop_1 new file mode 100755 index 000000000000..1d69b6f78654 --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_1 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table t + add chain t c { type filter hook output priority filter; } + add rule t c ip dscp set ip dscp and 0xc +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_2 b/tests/shell/testcases/chains/0044payload_binop_2 new file mode 100755 index 000000000000..2d09d24479d0 --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_2 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table t + add chain t c { type filter hook output priority filter; } + add rule t c ct mark set ct mark | ip dscp | 0x200 counter +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_3 b/tests/shell/testcases/chains/0044payload_binop_3 new file mode 100755 index 000000000000..7752af238409 --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_3 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table ip6 t + add chain ip6 t c { type filter hook output priority filter; } + add rule ip6 t c ip6 dscp set (ct mark & 0xfc000000) >> 26 +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_4 b/tests/shell/testcases/chains/0044payload_binop_4 new file mode 100755 index 000000000000..2c7792e9f929 --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_4 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table ip6 t + add chain ip6 t c { type filter hook output priority filter; } + add rule ip6 t c ip6 dscp set ip6 dscp and 0xc +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/0044payload_binop_5 b/tests/shell/testcases/chains/0044payload_binop_5 new file mode 100755 index 000000000000..aa82cd1c299e --- /dev/null +++ b/tests/shell/testcases/chains/0044payload_binop_5 @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +RULESET=" + add table ip6 t + add chain ip6 t c { type filter hook output priority filter; } + add rule ip6 t c ct mark set ct mark | ip6 dscp | 0x200 counter +" + +$NFT -f - <<< "$RULESET" diff --git a/tests/shell/testcases/chains/dumps/0040mark_binop_10.nft b/tests/shell/testcases/chains/dumps/0040mark_binop_10.nft new file mode 100644 index 000000000000..5566f7298461 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0040mark_binop_10.nft @@ -0,0 +1,6 @@ +table ip t { + chain c { + type filter hook output priority filter; policy accept; + ct mark set ct mark & 0xffff0000 | meta mark & 0x0000ffff + } +} diff --git a/tests/shell/testcases/chains/dumps/0040mark_binop_11.nft b/tests/shell/testcases/chains/dumps/0040mark_binop_11.nft new file mode 100644 index 000000000000..719980d55341 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0040mark_binop_11.nft @@ -0,0 +1,6 @@ +table ip t { + chain c { + type filter hook input priority filter; policy accept; + meta mark set ct mark & 0xffff0000 | meta mark & 0x0000ffff + } +} diff --git a/tests/shell/testcases/chains/dumps/0040mark_binop_12.nft b/tests/shell/testcases/chains/dumps/0040mark_binop_12.nft new file mode 100644 index 000000000000..bd589fe549f7 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0040mark_binop_12.nft @@ -0,0 +1,6 @@ +table ip6 t { + chain c { + type filter hook output priority filter; policy accept; + ct mark set ct mark & 0xffff0000 | meta mark & 0x0000ffff + } +} diff --git a/tests/shell/testcases/chains/dumps/0040mark_binop_13.nft b/tests/shell/testcases/chains/dumps/0040mark_binop_13.nft new file mode 100644 index 000000000000..2b046b128fb2 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0040mark_binop_13.nft @@ -0,0 +1,6 @@ +table ip6 t { + chain c { + type filter hook input priority filter; policy accept; + meta mark set ct mark & 0xffff0000 | meta mark & 0x0000ffff + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_0.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_0.nft new file mode 100644 index 000000000000..5aaf1353bdc8 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_0.nft @@ -0,0 +1,6 @@ +table ip t { + chain c { + type filter hook output priority filter; policy accept; + ip dscp set (ct mark & 0xfc000000) >> 26 + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_1.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_1.nft new file mode 100644 index 000000000000..54f744b54a3a --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_1.nft @@ -0,0 +1,6 @@ +table ip t { + chain c { + type filter hook output priority filter; policy accept; + ip dscp set ip dscp & af12 + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_2.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_2.nft new file mode 100644 index 000000000000..ed347bb2788a --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_2.nft @@ -0,0 +1,6 @@ +table ip t { + chain c { + type filter hook output priority filter; policy accept; + ct mark set ct mark | ip dscp | 0x00000200 counter packets 0 bytes 0 + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_3.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_3.nft new file mode 100644 index 000000000000..64da4a77cb5c --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_3.nft @@ -0,0 +1,6 @@ +table ip6 t { + chain c { + type filter hook output priority filter; policy accept; + ip6 dscp set (ct mark & 0xfc000000) >> 26 + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_4.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_4.nft new file mode 100644 index 000000000000..e863f44ef991 --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_4.nft @@ -0,0 +1,6 @@ +table ip6 t { + chain c { + type filter hook output priority filter; policy accept; + ip6 dscp set ip6 dscp & af12 + } +} diff --git a/tests/shell/testcases/chains/dumps/0044payload_binop_5.nft b/tests/shell/testcases/chains/dumps/0044payload_binop_5.nft new file mode 100644 index 000000000000..ccdb93d74a9a --- /dev/null +++ b/tests/shell/testcases/chains/dumps/0044payload_binop_5.nft @@ -0,0 +1,6 @@ +table ip6 t { + chain c { + type filter hook output priority filter; policy accept; + ct mark set ct mark | ip6 dscp | 0x00000200 counter packets 0 bytes 0 + } +} -- 2.35.1