mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Generalise cached NXDOMAIN replies.
We can cache an NXDOMAIN reply to a query for any RRTYPE and reply from a cached NXDOMAIN to any RRTYPE.
This commit is contained in:
@@ -894,8 +894,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
|
|||||||
{
|
{
|
||||||
flags &= ~(F_IPV4 | F_IPV6 | F_SRV);
|
flags &= ~(F_IPV4 | F_IPV6 | F_SRV);
|
||||||
|
|
||||||
/* Can store NXDOMAIN reply to CNAME or ANY query. */
|
/* Can store NXDOMAIN reply for any qtype. */
|
||||||
if (qtype == T_CNAME || qtype == T_ANY)
|
|
||||||
insert = 1;
|
insert = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2081,8 +2080,23 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ans)
|
if (!ans)
|
||||||
|
{
|
||||||
|
/* We may know that the domain doesn't exist for any RRtype. */
|
||||||
|
if ((crecp = cache_find_by_name(NULL, name, now, F_NXDOMAIN)))
|
||||||
|
{
|
||||||
|
ans = nxdomain = 1;
|
||||||
|
auth = 0;
|
||||||
|
|
||||||
|
if (!(crecp->flags & F_DNSSECOK))
|
||||||
|
sec_data = 0;
|
||||||
|
|
||||||
|
if (!dryrun)
|
||||||
|
log_query(F_NXDOMAIN | F_NEG, name, NULL, NULL, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
return 0; /* failed to answer a question */
|
return 0; /* failed to answer a question */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dryrun)
|
if (dryrun)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user