From: Florian Westphal Date: Sun, 2 Mar 2025 06:50:27 +0000 (+0100) Subject: tests: add atomic chain replace test X-Git-Tag: v1.1.2~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5758527a2b5753354aa154446d0753876a6a71b3;p=thirdparty%2Fnftables.git tests: add atomic chain replace test Add a test that replaces one base chain and check that no filtered packets make it through, i.e. that the 'old chain' doesn't disappear before new one is active. Acked-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- diff --git a/tests/shell/testcases/transactions/atomic_replace.sh b/tests/shell/testcases/transactions/atomic_replace.sh new file mode 100755 index 00000000..dce17860 --- /dev/null +++ b/tests/shell/testcases/transactions/atomic_replace.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +set -e + +rnd=$(mktemp -u XXXXXXXX) +ns="nft-atomic-$rnd" +pid1="" +pid2="" +duration=8 + +cleanup() +{ + kill "$pid1" "$pid2" + ip netns del "$ns" +} + +trap cleanup EXIT + +ip netns add "$ns" || exit 111 +ip -net "$ns" link set lo up + +ip netns exec "$ns" ping 127.0.0.1 -q -c 1 + +ip netns exec "$ns" $NFT -f - <