From 96599df7daa62db2361ff8e8097730284832ba0b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 18 Dec 2024 12:01:10 +0100 Subject: [PATCH] kr_request: add a .ratelimited flag This makes it simpler for other parts of resolver to react to this situation, e.g. custom modules pushing the information to analytics. --- daemon/lua/kres-gen-33.lua | 1 + daemon/ratelimiting.c | 1 + lib/resolve.h | 1 + 3 files changed, 3 insertions(+) diff --git a/daemon/lua/kres-gen-33.lua b/daemon/lua/kres-gen-33.lua index e8adbda63..9bf16b7f4 100644 --- a/daemon/lua/kres-gen-33.lua +++ b/daemon/lua/kres-gen-33.lua @@ -250,6 +250,7 @@ struct kr_request { _Bool answ_validated; _Bool auth_validated; _Bool stale_accounted; + _Bool ratelimited; uint8_t rank; struct kr_rplan rplan; trace_log_f trace_log; diff --git a/daemon/ratelimiting.c b/daemon/ratelimiting.c index 996beaaf6..d182658e4 100644 --- a/daemon/ratelimiting.c +++ b/daemon/ratelimiting.c @@ -189,6 +189,7 @@ bool ratelimiting_request_begin(struct kr_request *req) } } + req->ratelimited = true; // we set this even on dry_run if (ratelimiting->dry_run) return false; // perform limiting diff --git a/lib/resolve.h b/lib/resolve.h index b3e6614d2..ef4f3f467 100644 --- a/lib/resolve.h +++ b/lib/resolve.h @@ -265,6 +265,7 @@ struct kr_request { bool answ_validated; /**< internal to validator; beware of caching, etc. */ bool auth_validated; /**< see answ_validated ^^ ; TODO */ bool stale_accounted; + bool ratelimited; /**< this request shot over the rate limit */ /** Overall rank for the request. * -- 2.47.2