]> granicus.if.org Git - pdns/commitdiff
comment zeroScope, plus make sure we don't pass subnet to packetcache for zeroScope
authorbert hubert <bert.hubert@powerdns.com>
Mon, 8 Oct 2018 15:09:12 +0000 (17:09 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 10 Jan 2019 09:56:01 +0000 (10:56 +0100)
pdns/dnsdist.cc

index ce48a2c58f847f42bbdd736897560327b099923f..1e9cc22cf37ff4213d7b39a775f8f718c38e673f 100644 (file)
@@ -524,7 +524,8 @@ try {
         }
 
         if (ids->packetCache && !ids->skipCache) {
-          ids->packetCache->insert(zeroScope ? ids->cacheKeyNoECS : ids->cacheKey, ids->subnet, ids->origFlags, ids->dnssecOK, ids->qname, ids->qtype, ids->qclass, response, responseLen, false, dh->rcode, ids->tempFailureTTL);
+          // if zeroScope, pass the pre-ECS hash-key and do not pass the subnet to the cache
+          ids->packetCache->insert(zeroScope ? ids->cacheKeyNoECS : ids->cacheKey, zeroScope ? boost::none : ids->subnet, ids->origFlags, ids->dnssecOK, ids->qname, ids->qtype, ids->qclass, response, responseLen, false, dh->rcode, ids->tempFailureTTL);
         }
 
         if (ids->cs && !ids->cs->muted) {
@@ -1419,6 +1420,7 @@ static void processUDPQuery(ClientState& cs, LocalHolders& holders, const struct
     }
 
     if (dq.useECS && ((ss && ss->useECS) || (!ss && serverPool->getECS()))) {
+      // we special case our cache in case a downstream explicitly gave us a universally valid resposne with a 0 scope
       if (packetCache && !dq.skipCache && packetCache->get(dq, consumed, dh->id, query, &cachedResponseSize, &cacheKeyNoECS, subnet, dnssecOK, allowExpired)) {
         goto sendIt;
       }