From 8d443adfcc8c19effd6be9a9c903ee96e374f2e8 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Tue, 11 Jan 2022 12:08:59 +0100 Subject: evaluate: attempt to set_eval flag if dynamic updates requested When passing no upper size limit, the dynset expression forces an internal 64k upperlimit. In some cases, this can result in 'nft -f' to restore the ruleset. Avoid this by always setting the EVAL flag on a set definition when we encounter packet-path update attempt in the batch. Reported-by: Yi Chen Suggested-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- .../shell/testcases/sets/dumps/dynset_missing.nft | 12 ++++++++ tests/shell/testcases/sets/dynset_missing | 32 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/shell/testcases/sets/dumps/dynset_missing.nft create mode 100755 tests/shell/testcases/sets/dynset_missing (limited to 'tests/shell/testcases') diff --git a/tests/shell/testcases/sets/dumps/dynset_missing.nft b/tests/shell/testcases/sets/dumps/dynset_missing.nft new file mode 100644 index 00000000..6c8ed323 --- /dev/null +++ b/tests/shell/testcases/sets/dumps/dynset_missing.nft @@ -0,0 +1,12 @@ +table ip test { + set dlist { + type ipv4_addr + size 65535 + flags dynamic + } + + chain output { + type filter hook output priority filter; policy accept; + udp dport 1234 update @dlist { ip daddr } counter packets 0 bytes 0 + } +} diff --git a/tests/shell/testcases/sets/dynset_missing b/tests/shell/testcases/sets/dynset_missing new file mode 100755 index 00000000..fdf5f49e --- /dev/null +++ b/tests/shell/testcases/sets/dynset_missing @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +$NFT -f /dev/stdin < $tmpfile + +# this restore works, because set is still the rhash backend. +$NFT -f $tmpfile # success +$NFT flush ruleset + +# fails without commit 'attempt to set_eval flag if dynamic updates requested', +# because set in $tmpfile has 'size x' but no 'flags dynamic'. +$NFT -f $tmpfile -- cgit v1.2.3