Don't empty reply packets received from upstream marked as truncated.

It's concievable that upstream, has provided a useful minimal reply.

After a patch from Rahul Thakur.
This commit is contained in:
Simon Kelley
2024-11-23 23:38:31 +00:00
parent 8bd54efceb
commit 334e144c36

View File

@@ -737,14 +737,8 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
} }
if (header->hb3 & HB3_TC) if (header->hb3 & HB3_TC)
{
log_query(F_UPSTREAM, NULL, NULL, "truncated", 0); log_query(F_UPSTREAM, NULL, NULL, "truncated", 0);
header->ancount = htons(0); else if (!bogusanswer || (header->hb4 & HB4_CD))
header->nscount = htons(0);
header->arcount = htons(0);
}
if (!(header->hb3 & HB3_TC) && (!bogusanswer || (header->hb4 & HB4_CD)))
{ {
if (rcode == NXDOMAIN && extract_request(header, n, daemon->namebuff, NULL) && if (rcode == NXDOMAIN && extract_request(header, n, daemon->namebuff, NULL) &&
(check_for_local_domain(daemon->namebuff, now) || lookup_domain(daemon->namebuff, F_CONFIG, NULL, NULL))) (check_for_local_domain(daemon->namebuff, now) || lookup_domain(daemon->namebuff, F_CONFIG, NULL, NULL)))