]> granicus.if.org Git - pdns/commitdiff
robustify and comment detection of /0 answers
authorbert hubert <bert.hubert@powerdns.com>
Mon, 8 Oct 2018 15:01:20 +0000 (17:01 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 10 Jan 2019 09:56:01 +0000 (10:56 +0100)
pdns/dnsdist.cc

index 21e76401aef41d8922a22b5036bd9102087c8a68..ce48a2c58f847f42bbdd736897560327b099923f 100644 (file)
@@ -301,8 +301,10 @@ bool fixUpResponse(char** response, uint16_t* responseLen, size_t* responseSize,
     int res = locateEDNSOptRR(responseStr, &optStart, &optLen, &last);
 
     if (res == 0) {
-      if(zeroScope)
-        *zeroScope = optLen > 18 && !responseStr.at(optStart + 18);
+      if(zeroScope) { // this finds if an EDNS scope was set, and if it is 0
+        *zeroScope = optLen > 18 && !responseStr.at(optStart + 18) && !responseStr.at(optStart + 11) && responseStr.at(optStart + 12) ==8;
+      }
+      // this test only detects a /0 if ECS is the first option
 
       if (ednsAdded) {
         /* we added the entire OPT RR,