]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
kr_request: add a .ratelimited flag docs-develop-rate-aactgk/deployments/6060
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 18 Dec 2024 11:01:10 +0000 (12:01 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 20 Jan 2025 08:16:32 +0000 (09:16 +0100)
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
daemon/ratelimiting.c
lib/resolve.h

index e8adbda63e02d658270fdd360eb7ee8ca4840d4f..9bf16b7f460a40dfd10d6d2e7683b31a648f0874 100644 (file)
@@ -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;
index 996beaaf6170f733f8d9e3297ce829a5c6a39602..d182658e49b5aa090ea49a8dac23440eb6605036 100644 (file)
@@ -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
index b3e6614d2bf6dc0669edefe5a24f0503dfc39355..ef4f3f4678ce10c04a6805ecc04947d64a093339 100644 (file)
@@ -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.
         *