]> granicus.if.org Git - pdns/commitdiff
fix OPT inclusion in truncated responses to EDNS queries
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Tue, 18 Jun 2013 17:02:49 +0000 (19:02 +0200)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Mon, 24 Jun 2013 09:41:04 +0000 (11:41 +0200)
pdns/dnspacket.cc
regression-tests/direct-rrsig/command
regression-tests/direct-rrsig/expected_result
regression-tests/direct-rrsig/expected_result.dnssec

index 6c4707d6e7e7e8c4fd07791f21b89b6be22bcd74..d7f082e68c8ac033359e9476ea6825b6bb0dc850 100644 (file)
@@ -310,7 +310,7 @@ void DNSPacket::wrapup()
           if(pos->d_place == DNSResourceRecord::ANSWER || pos->d_place == DNSResourceRecord::AUTHORITY) {
             pw.getHeader()->tc=1;
           }
-          goto noCommit;
+          goto truncated;
         }
       }
       
@@ -323,12 +323,15 @@ void DNSPacket::wrapup()
         opts.push_back(make_pair(::arg().asNum("edns-subnet-option-number"), opt));
       }
 
+      pw.commit();
+
+      truncated:;
+
       if(!opts.empty() || d_haveednssection || d_dnssecOk)
+      {
         pw.addOpt(2800, 0, d_dnssecOk ? EDNSOpts::DNSSECOK : 0, opts);
-
-      if(!pw.getHeader()->tc) // protect against double commit from addSignature
         pw.commit();
-      noCommit:;
+      }
     }
     catch(std::exception& e) {
       L<<Logger::Warning<<"Exception: "<<e.what()<<endl;
index b21880c2f16eba11c135f8265a8aa18203311cdf..138ab821309faa6e2697089dbd902a0f77a55e0f 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/sh
-cleandig example.com RRSIG
+cleandig example.com RRSIG dnssec
index 8632b850c77684de8b3ae448203417bbb6cd8c4a..04adefd9cbabab56bd3db57bbb2dc13640b58020 100644 (file)
@@ -1,3 +1,4 @@
 1      example.com.    IN      SOA     86400   ns1.example.com. ahu.example.com. 2000081501 28800 7200 604800 86400
+2      .       IN      OPT     32768   
 Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
 Reply to question for qname='example.com.', qtype=RRSIG
index 0e19bc51666b9494d135b71dce785d5bd07876e4..840b7fdd1638f13e39423cb8d89d971c339f9d38 100644 (file)
@@ -1,4 +1,8 @@
 0      example.com.    IN      RRSIG   100000  SOA 8 2 100000 [expiry] [inception] [keytag] example.com. ...
+0      example.com.    IN      RRSIG   120     MX 8 2 120 [expiry] [inception] [keytag] example.com. ...
 0      example.com.    IN      RRSIG   120     NS 8 2 120 [expiry] [inception] [keytag] example.com. ...
-Rcode: 0, RD: 0, QR: 1, TC: 1, AA: 1, opcode: 0
+0      example.com.    IN      RRSIG   86400   DNSKEY 8 2 86400 [expiry] [inception] [keytag] example.com. ...
+0      example.com.    IN      RRSIG   86400   NSEC 8 2 86400 [expiry] [inception] [keytag] example.com. ...
+2      .       IN      OPT     32768   
+Rcode: 0, RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0
 Reply to question for qname='example.com.', qtype=RRSIG