- Fix ratelimit inconsistency, for ip-ratelimits the value is the

amount allowed, like for ratelimits.
This commit is contained in:
W.C.A. Wijngaards 2022-08-04 11:33:37 +02:00
parent 1c164ab442
commit fbe8e3b0b2
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
4 August 2022: Wouter
- Fix ratelimit inconsistency, for ip-ratelimits the value is the
amount allowed, like for ratelimits.
2 August 2022: Wouter 2 August 2022: Wouter
- Fix edns subnet so that scope 0 answers only match sourcemask 0 - Fix edns subnet so that scope 0 answers only match sourcemask 0
queries for answers from cache if from a query with sourcemask 0. queries for answers from cache if from a query with sourcemask 0.

View file

@ -1040,7 +1040,7 @@ int infra_ratelimit_exceeded(struct infra_cache* infra, uint8_t* name,
max = infra_rate_max(entry->data, timenow, backoff); max = infra_rate_max(entry->data, timenow, backoff);
lock_rw_unlock(&entry->lock); lock_rw_unlock(&entry->lock);
return (max >= lim); return (max > lim);
} }
size_t size_t
@ -1073,7 +1073,7 @@ int infra_ip_ratelimit_inc(struct infra_cache* infra,
max = infra_rate_max(entry->data, timenow, backoff); max = infra_rate_max(entry->data, timenow, backoff);
lock_rw_unlock(&entry->lock); lock_rw_unlock(&entry->lock);
if(premax < infra_ip_ratelimit && max >= infra_ip_ratelimit) { if(premax <= infra_ip_ratelimit && max > infra_ip_ratelimit) {
char client_ip[128], qnm[LDNS_MAX_DOMAINLEN+1+12+12]; char client_ip[128], qnm[LDNS_MAX_DOMAINLEN+1+12+12];
addr_to_str((struct sockaddr_storage *)&repinfo->addr, addr_to_str((struct sockaddr_storage *)&repinfo->addr,
repinfo->addrlen, client_ip, sizeof(client_ip)); repinfo->addrlen, client_ip, sizeof(client_ip));