Make locally generated truncated answers consistent.

process_reply() is no longer doing this.
This commit is contained in:
Simon Kelley
2024-11-24 08:25:57 +00:00
parent d2790914df
commit 163c05c61d
3 changed files with 21 additions and 4 deletions

View File

@@ -2327,14 +2327,20 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
/* truncation */
if (trunc)
header->hb3 |= HB3_TC;
{
header->hb3 |= HB3_TC;
if (!(ansp = skip_questions(header, qlen)))
return 0; /* bad packet */
anscount = nscount = addncount = 0;
}
if (nxdomain)
SET_RCODE(header, NXDOMAIN);
else if (notimp)
SET_RCODE(header, NOTIMP);
else
SET_RCODE(header, NOERROR); /* no error */
header->ancount = htons(anscount);
header->nscount = htons(nscount);
header->arcount = htons(addncount);