From 334e144c36fd70c942e39db37994b7260f46bafc Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Sat, 23 Nov 2024 23:38:31 +0000 Subject: [PATCH] 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. --- src/forward.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/forward.c b/src/forward.c index ae88225..2491dbb 100644 --- a/src/forward.c +++ b/src/forward.c @@ -737,14 +737,8 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server } if (header->hb3 & HB3_TC) - { - log_query(F_UPSTREAM, NULL, NULL, "truncated", 0); - header->ancount = htons(0); - header->nscount = htons(0); - header->arcount = htons(0); - } - - if (!(header->hb3 & HB3_TC) && (!bogusanswer || (header->hb4 & HB4_CD))) + log_query(F_UPSTREAM, NULL, NULL, "truncated", 0); + else if (!bogusanswer || (header->hb4 & HB4_CD)) { 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)))