From b88526ce6da4f603fcf6d63b54fccb41b8006a0c Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Thu, 9 Mar 2017 17:51:50 +0100 Subject: [PATCH] Add a bunch of comments --- pdns/dnsparser.hh | 2 +- pdns/dnsrecords.cc | 3 +++ pdns/syncres.cc | 13 ++++++++++++- pdns/syncres.hh | 7 +++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pdns/dnsparser.hh b/pdns/dnsparser.hh index 10a6ab17a..1f0ca6a5b 100644 --- a/pdns/dnsparser.hh +++ b/pdns/dnsparser.hh @@ -361,7 +361,7 @@ public: typedef vector > 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 getPacketReader(uint16_t offset) diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 11fc94a92..0a69e7955 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -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; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 76cd5089d..1367284c7 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -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&ret, unsigned int depth, set& beenthere) { string prefix; @@ -422,6 +431,8 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vectornegcache, 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); } diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 727c9adc3..344ef145f 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -543,7 +543,14 @@ private: ostringstream d_trace; shared_ptr 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; -- 2.50.1