summaryrefslogtreecommitdiffhomepage
path: root/src/selftest
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-07-06 01:41:30 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-06 17:36:35 +0200
commit09cb05bdf26a5e865c2a826d2f190ab6456a53c8 (patch)
treeac0c097cad2bd4da7deec3ec3e0ef5c8c3853f2a /src/selftest
parent03086abb5da4fcdb0c60c831abb40565c4d23891 (diff)
selftest: ratelimiter: improve chance of success via retry
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/selftest')
-rw-r--r--src/selftest/ratelimiter.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/selftest/ratelimiter.h b/src/selftest/ratelimiter.h
index 0bdff1e..c05eac7 100644
--- a/src/selftest/ratelimiter.h
+++ b/src/selftest/ratelimiter.h
@@ -121,6 +121,8 @@ restart:
#endif
}
+ tries = 0;
+restart2:
gc_entries(NULL);
rcu_barrier();
@@ -130,8 +132,11 @@ restart:
for (i = 0; i <= max_entries; ++i) {
hdr4->saddr = htonl(i);
- if (ratelimiter_allow(skb4, &init_net) != (i != max_entries))
+ if (ratelimiter_allow(skb4, &init_net) != (i != max_entries)) {
+ if (++tries < 5000)
+ goto restart2;
goto err;
+ }
++test;
}