From: Peter van Dijk Date: Fri, 31 Aug 2018 20:41:21 +0000 (+0200) Subject: actually truncate truncated responses; fixes #6912 X-Git-Tag: dnsdist-1.3.3~120^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdc8ccd71098ee679de85bf0a8e0ada017ed45a4;p=pdns actually truncate truncated responses; fixes #6912 --- diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index c7c1d486f..b5fcdb51c 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -319,6 +319,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