]> granicus.if.org Git - pdns/commitdiff
Add a bunch of comments
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 9 Mar 2017 16:51:50 +0000 (17:51 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 4 Apr 2017 15:10:43 +0000 (17:10 +0200)
pdns/dnsparser.hh
pdns/dnsrecords.cc
pdns/syncres.cc
pdns/syncres.hh

index 10a6ab17afa3d88a53e4641c2346740a6d87d0a9..1f0ca6a5b925a4b92242316279d625ecd99e4a82 100644 (file)
@@ -361,7 +361,7 @@ public:
 
   typedef vector<pair<DNSRecord, uint16_t > > answers_t;
   
-  //! All answers contained in this packet
+  //! All answers contained in this packet (everything *but* the question section)
   answers_t d_answers;
 
   shared_ptr<PacketReader> getPacketReader(uint16_t offset)
index 11fc94a9207a456969b07dfff171d70104ebefab..0a69e7955a1175278bb345c66aeca05bef3771dd 100644 (file)
@@ -500,6 +500,9 @@ uint16_t DNSKEYRecordContent::getTag()
 }
 
 
+/*
+ * Fills `eo` by parsing the EDNS(0) OPT RR (RFC 6891)
+ */
 bool getEDNSOpts(const MOADNSParser& mdp, EDNSOpts* eo)
 {
   eo->d_Z=0;
index 76cd5089dd853a880b32a6bf2d655a11a0d87a9c..1367284c77a459bd639b0e90a4cd8e4f97ba54a5 100644 (file)
@@ -408,6 +408,15 @@ int SyncRes::asyncresolveWrapper(const ComboAddress& ip, bool ednsMANDATORY, con
   return ret;
 }
 
+/*! This function will check the cache and go out to the internet if the answer is not in cache
+ *
+ * \param qname The name we need an answer for
+ * \param qtype
+ * \param ret The vector of DNSRecords we need to fill with the answers
+ * \param depth The recursion depth we are in
+ * \param beenthere
+ * \return DNS RCODE or -1 (Error) or -2 (RPZ hit)
+ */
 int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector<DNSRecord>&ret, unsigned int depth, set<GetBestNSAnswer>& beenthere)
 {
   string prefix;
@@ -422,6 +431,8 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector<DNSRecor
     throw ImmediateServFailException("More than "+std::to_string(s_maxdepth)+" (max-recursion-depth) levels of recursion needed while resolving "+qname.toLogString());
 
   int res=0;
+
+  // This is a difficult way of expressing "this is a normal query", i.e. not getRootNS.
   if(!(d_nocache && qtype.getCode()==QType::NS && qname.isRoot())) {
     if(d_cacheonly) { // very limited OOB support
       LWResult lwr;
@@ -1179,7 +1190,7 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co
         ne.d_qtype=QType(0); // this encodes 'whole record'
         ne.d_dnssecProof = harvestRecords(lwr.d_records, {QType::NSEC, QType::NSEC3});
         replacing_insert(t_sstorage->negcache, ne);
-        if(s_rootNXTrust && auth.isRoot()) {
+        if(s_rootNXTrust && auth.isRoot()) { // We should check if it was forwarded here, see issue #5107
           ne.d_name = getLastLabel(ne.d_name);
           replacing_insert(t_sstorage->negcache, ne);
         }
index 727c9adc30260bd31a13613d4a0013c0d1030b6a..344ef145f23e75eb79c39dd356a709b854237f84 100644 (file)
@@ -543,7 +543,14 @@ private:
   ostringstream d_trace;
   shared_ptr<RecursorLua4> d_pdl;
   string d_prefix;
+
+  /* When d_cacheonly is set to true, we will only check the cache.
+   * This is set when the RD bit is unset in the incoming query
+   */
   bool d_cacheonly;
+  /* d_nocache is *only* set in getRootNS() (in pdns_recursor.cc).
+   * It forces us to not look in the cache or local auth.
+   */
   bool d_nocache;
   bool d_doEDNS0;