]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
fixup! rrl: truncating answers when close to limit, dropping over limit docs-develop-rrl-8r8r8r/deployments/4018
authorLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 7 May 2024 09:03:12 +0000 (11:03 +0200)
committerLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 7 May 2024 13:42:04 +0000 (15:42 +0200)
daemon/rrl/api.c
manager/knot_resolver_manager/datamodel/rate_limiting_schema.py

index 5aa729e61fc34fc09f280325085a91a7d22f1f34..4cccdbfde50097a2a26c86ff5a475b2a43b1f37c 100644 (file)
@@ -183,14 +183,14 @@ bool kr_rrl_request_begin(struct kr_request *req)
        }
        if (!limited) return false;
 
-       knot_pkt_t *answer = kr_request_ensure_answer(req);
-       if (!answer) { // something bad; TODO: perhaps improve recovery from this
-               kr_assert(false);
-               return true;
-       }
-       // at this point the packet should be pretty clear
-
        if (limited == 1) {
+               knot_pkt_t *answer = kr_request_ensure_answer(req);
+               if (!answer) { // something bad; TODO: perhaps improve recovery from this
+                       kr_assert(false);
+                       return true;
+               }
+               // at this point the packet should be pretty clear
+
                // TC=1.
                knot_wire_set_tc(answer->wire);
                knot_wire_clear_ad(answer->wire);
index f2b99f4418d1ebadccaa36d32919d1524bdc4718..4733223fa619f85afa0a926645ef1683c45cb0c8 100644 (file)
@@ -1,5 +1,5 @@
-from knot_resolver_manager.utils.modeling import ConfigSchema
 from knot_resolver_manager.datamodel.types import Percent
+from knot_resolver_manager.utils.modeling import ConfigSchema
 
 
 class RateLimitingSchema(ConfigSchema):
@@ -16,7 +16,7 @@ class RateLimitingSchema(ConfigSchema):
     capacity: int = 524288
     rate_limit: int
     instant_limit: int = 50
-    tc_limit_perc: Percent = Percent(90);
+    tc_limit_perc: Percent = Percent(90)
 
     def _validate(self) -> None:
         max_instant_limit = int(2**32 / 768 - 1)