From 09cb05bdf26a5e865c2a826d2f190ab6456a53c8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 6 Jul 2018 01:41:30 +0200 Subject: selftest: ratelimiter: improve chance of success via retry Signed-off-by: Jason A. Donenfeld --- src/selftest/ratelimiter.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3