]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: always truncate when the additional records do not fit
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 4 Jun 2019 18:02:24 +0000 (20:02 +0200)
committermind04 <mind04@monshouwer.org>
Tue, 4 Jun 2019 18:16:29 +0000 (20:16 +0200)
in a response
fixes #7315

pdns/dnspacket.cc
regression-tests/tests/too-big-for-udp-query-always-truncate-additional/command [moved from regression-tests/tests/too-big-for-udp-query-no-truncate-additional/command with 100% similarity]
regression-tests/tests/too-big-for-udp-query-always-truncate-additional/description [moved from regression-tests/tests/too-big-for-udp-query-no-truncate-additional/description with 53% similarity]
regression-tests/tests/too-big-for-udp-query-always-truncate-additional/expected_result [new file with mode: 0644]
regression-tests/tests/too-big-for-udp-query-no-truncate-additional/expected_result [deleted file]

index c7f3070338e29e4c15c1ef05d37cebb43964cbfd..ac752f506fc7439a002a2c480b2e03780e72b8e4 100644 (file)
@@ -340,10 +340,8 @@ void DNSPacket::wrapup()
         pos->dr.d_content->toPacket(pw);
         if(pw.size() + optsize > (d_tcp ? 65535 : getMaxReplyLen())) {
           pw.rollback();
-          if(pos->dr.d_place == DNSResourceRecord::ANSWER || pos->dr.d_place == DNSResourceRecord::AUTHORITY) {
-            pw.truncate();
-            pw.getHeader()->tc=1;
-          }
+          pw.truncate();
+          pw.getHeader()->tc=1;
           goto noCommit;
         }
       }
similarity index 53%
rename from regression-tests/tests/too-big-for-udp-query-no-truncate-additional/description
rename to regression-tests/tests/too-big-for-udp-query-always-truncate-additional/description
index e694a2fcad1cc32234ce1aa3d62a1a88f208861d..b00e0ccc74e69e62af860617fa66e25387eff3d0 100644 (file)
@@ -1,4 +1,6 @@
 UDP dns packets can only be 512 bytes long - when they are longer, they need
 to get truncated, and have the 'TC' bit set, to inform the client that they
 need to requery over TCP. This query however does not need truncation, since
-the information that causes things to go over limit is 'additional'.
+the information that causes things to go over limit are 'courtesy' additionals.
+But truncation is harmless and will avoid a lot of additional complexity.
+https://tools.ietf.org/html/rfc4472#appendix-B
diff --git a/regression-tests/tests/too-big-for-udp-query-always-truncate-additional/expected_result b/regression-tests/tests/too-big-for-udp-query-always-truncate-additional/expected_result
new file mode 100644 (file)
index 0000000..d714295
--- /dev/null
@@ -0,0 +1,2 @@
+Rcode: 0 (No Error), RD: 0, QR: 1, TC: 1, AA: 1, opcode: 0
+Reply to question for qname='together-too-much.example.com.', qtype=MX
diff --git a/regression-tests/tests/too-big-for-udp-query-no-truncate-additional/expected_result b/regression-tests/tests/too-big-for-udp-query-no-truncate-additional/expected_result
deleted file mode 100644 (file)
index 99aa109..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-0      together-too-much.example.com.  IN      MX      120     25 toomuchinfo-X.example.com.
-0      together-too-much.example.com.  IN      MX      120     25 toomuchinfo-X.example.com.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-2      toomuchinfo-X.example.com.      IN      A       120     192.168.99.
-Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
-Reply to question for qname='together-too-much.example.com.', qtype=MX