summaryrefslogtreecommitdiff
path: root/src/rfc1035.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rfc1035.c')
-rw-r--r--src/rfc1035.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 1693253..3d82ad9 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -894,9 +894,8 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
{
flags &= ~(F_IPV4 | F_IPV6 | F_SRV);
- /* Can store NXDOMAIN reply to CNAME or ANY query. */
- if (qtype == T_CNAME || qtype == T_ANY)
- insert = 1;
+ /* Can store NXDOMAIN reply for any qtype. */
+ insert = 1;
}
log_query(F_UPSTREAM | F_FORWARD | F_NEG | flags | (secure ? F_DNSSECOK : 0), name, NULL, NULL, 0);
@@ -2081,7 +2080,22 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
}
if (!ans)
- return 0; /* failed to answer a question */
+ {
+ /* 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 */
+ }
}
if (dryrun)