]> git.ipfire.org Git - thirdparty/iptables.git/commit
tests: add test script for race-free restore
authorFlorian Westphal <fw@strlen.de>
Tue, 23 Apr 2019 13:16:25 +0000 (15:16 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 26 Apr 2019 23:08:54 +0000 (01:08 +0200)
commit4000b4cf2ea3826ea6f777e400cc5353ac89563c
treee2e410c0d548221d57f2f76eac3ae93e79559fc4
parent58d7de0181f61570bdf9ba2b88964d5009860c39
tests: add test script for race-free restore

xtables-nft-restore ignores -w, check that we don't add
duplicate rules when parallel restores happen.

With a slightly older iptables-nft version this ususally fails with:
I: [EXECUTING] iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0
iptables-restore v1.8.2 (nf_tables):
line 5: CHAIN_USER_ADD failed (File exists): chain UC-0
line 6: CHAIN_USER_ADD failed (File exists): chain UC-1
W: [FAILED] ipt-restore/0004-restore-race_0: expected 0 but got 4

or
I: [EXECUTING]   iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0
iptables-restore v1.8.2 (nf_tables):
line 1: TABLE_FLUSH failed (No such file or directory): table filter

or
/tmp/tmp.SItN4URxxF /tmp/tmp.P1y4LIxhTl differ: byte 7159, line 137

As the legacy version should not have such race (due to nature
of full-table-replace), only do one iteration for legacy case.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/tests/shell/testcases/ipt-restore/0004-restore-race_0 [new file with mode: 0755]