}
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);
-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):
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)