selftests: netfilter: nft_flowtable.sh: make first pass deterministic
authorFlorian Westphal <fw@strlen.de>
Tue, 22 Oct 2024 15:23:18 +0000 (17:23 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 29 Oct 2024 18:26:09 +0000 (11:26 -0700)
commitc59d72d0a4fbaa5fd7a04b2d13cfc101d01310db
tree1a64c18c186ec790d9a810ef81ae088d8a70a278
parent7515e37bce5c428a56a9b04ea7e96b3f53f17150
selftests: netfilter: nft_flowtable.sh: make first pass deterministic

The CI occasionaly encounters a failing test run.  Example:
 # PASS: ipsec tunnel mode for ns1/ns2
 # re-run with random mtus: -o 10966 -l 19499 -r 31322
 # PASS: flow offloaded for ns1/ns2
[..]
 # FAIL: ipsec tunnel ... counter 1157059 exceeds expected value 878489

This script will re-exec itself, on the second run, random MTUs are
chosen for the involved links.  This is done so we can cover different
combinations (large mtu on client, small on server, link has lowest
mtu, etc).

Furthermore, file size is random, even for the first run.

Rework this script and always use the same file size on initial run so
that at least the first round can be expected to have reproducible
behavior.

Second round will use random mtu/filesize.

Raise the failure limit to that of the file size, this should avoid all
errneous test errors.  Currently, first fin will remove the offload, so if
one peer is already closing remaining data is handled by classic path,
which result in larger-than-expected counter and a test failure.

Given packet path also counts tcp/ip headers, in case offload is
completely broken this test will still fail (as expected).

The test counter limit could be made more strict again in the future
once flowtable can keep a connection in offloaded state until FINs
in both directions were seen.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241022152324.13554-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/netfilter/nft_flowtable.sh