]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: use 100ms for set timeout
authorFlorian Westphal <fw@strlen.de>
Thu, 7 Jun 2018 16:31:59 +0000 (18:31 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 7 Jun 2018 16:32:17 +0000 (18:32 +0200)
Pablo reports set test fails with HZ=250, as it lists "324ms" instead
of "321".  This is because of rounding errors that occur when converting
from user-side millisecond scale to kernel-internal jiffies one.

use 100ms for now to avoid this error.
Alternatives would be to store use-provided value in kernel or to avoid
the conversions; this would require a change to make timeout independent from
jiffies on kernel side.

Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/sets/0031set_timeout_size_0

index a401ffa69dcbc1ea39d89a75c73862e1f6f50ea8..747d7dc7a5197c3b449caa3d6d431135beca58e0 100755 (executable)
@@ -4,9 +4,9 @@ RULESET="add table x
 add set x y { type ipv4_addr; size 128; timeout 30s; }
 add chain x test
 add rule x test set update ip saddr timeout 1d2h3m4s5ms @y
-add rule x test set update ip daddr timeout 321ms @y"
+add rule x test set update ip daddr timeout 100ms @y"
 
 set -e
 $NFT -f - <<< $RULESET
 $NFT list chain x test | grep -q 'update @y { ip saddr timeout 1d2h3m4s5ms }'
-$NFT list chain x test | grep -q 'update @y { ip daddr timeout 321ms }'
+$NFT list chain x test | grep -q 'update @y { ip daddr timeout 100ms }'