mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Handle resource exhaustion of struct frec_src same as struct frec.
Ie, by returning REFUSED response and (rate-limited) logging.
This commit is contained in:
@@ -352,9 +352,19 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
||||
daemon->free_frec_src->next = NULL;
|
||||
}
|
||||
|
||||
/* If we've been spammed with many duplicates, just drop the query. */
|
||||
/* If we've been spammed with many duplicates, return REFUSED. */
|
||||
if (!daemon->free_frec_src)
|
||||
return 0;
|
||||
{
|
||||
static time_t last_log = 0;
|
||||
|
||||
if ((int)difftime(now, last_log) > 5)
|
||||
{
|
||||
last_log = now;
|
||||
my_syslog(LOG_WARNING, _("Maximum number of concurrent DNS queries reached (max: %d)"), daemon->ftabsize);
|
||||
}
|
||||
|
||||
goto frec_err;
|
||||
}
|
||||
|
||||
src = daemon->free_frec_src;
|
||||
daemon->free_frec_src = src->next;
|
||||
@@ -630,6 +640,7 @@ static int forward_query(int udpfd, union mysockaddr *udpaddr,
|
||||
}
|
||||
|
||||
/* could not send on, return empty answer or address if known for whole domain */
|
||||
frec_err:
|
||||
if (udpfd != -1)
|
||||
{
|
||||
plen = setup_reply(header, plen, addrp, flags, daemon->local_ttl);
|
||||
|
||||
Reference in New Issue
Block a user