From 8e3395eb8cee4ded1219313dbbdd8bc3c047510e Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Fri, 31 Aug 2018 22:41:21 +0200 Subject: [PATCH] actually truncate truncated responses; fixes #6912 (cherry picked from commit cdc8ccd71098ee679de85bf0a8e0ada017ed45a4) --- pdns/dnspacket.cc | 1 + .../too-big-for-udp-query/expected_result | 28 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index a32dc1118..76674a283 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -323,6 +323,7 @@ void DNSPacket::wrapup() if(pw.size() + 20U > (d_tcp ? 65535 : getMaxReplyLen())) { // 20 = room for EDNS0 pw.rollback(); if(pos->dr.d_place == DNSResourceRecord::ANSWER || pos->dr.d_place == DNSResourceRecord::AUTHORITY) { + pw.truncate(); pw.getHeader()->tc=1; } goto noCommit; diff --git a/regression-tests/tests/too-big-for-udp-query/expected_result b/regression-tests/tests/too-big-for-udp-query/expected_result index 96f7bf9a3..c45a3aa2e 100644 --- a/regression-tests/tests/too-big-for-udp-query/expected_result +++ b/regression-tests/tests/too-big-for-udp-query/expected_result @@ -1,30 +1,2 @@ -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. -0 toomuchinfo-b.example.com. IN A 120 192.168.99. Rcode: 0 (No Error), RD: 0, QR: 1, TC: 1, AA: 1, opcode: 0 Reply to question for qname='toomuchinfo-b.example.com.', qtype=A -- 2.40.0