From: Remi Gacogne Date: Mon, 25 May 2020 09:33:19 +0000 (+0200) Subject: rec: Defer the NOD lookup until after the response has been sent X-Git-Tag: dnsdist-1.5.0-rc3~32^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9142%2Fhead;p=thirdparty%2Fpdns.git rec: Defer the NOD lookup until after the response has been sent If the NOD lookup is slow, for example because the destination authoritative server is down, doing the NOD lookup before the response has been sent increases the latency a lot. This commit moves the actual NOD lookup after the response has been sent, so we can still use the existing mthread (we might actually need to do a proper DNS resolution to find the target authoritative server) without keeping the client waiting. --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 29e0c05c6b..6d4914589a 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1038,8 +1038,6 @@ static bool checkFrameStreamExport(LocalStateHolder& luaconfsLoc #ifdef NOD_ENABLED static bool nodCheckNewDomain(const DNSName& dname) { - static const QType qt(QType::A); - static const uint16_t qc(QClass::IN); bool ret = false; // First check the (sub)domain isn't whitelisted for NOD purposes if (!g_nodDomainWL.check(dname)) { @@ -1049,19 +1047,24 @@ static bool nodCheckNewDomain(const DNSName& dname) // This should probably log to a dedicated log file g_log<getTid()<<"/"<numProcesses()<<"] answer to "<<(dc->d_mdp.d_header.rd?"":"non-rd ")<<"question '"<d_mdp.d_qname<<"|"<d_mdp.d_qtype); g_log<<"': "<ancount)<<" answers, "<arcount)<<" additional, took "<d_mdp.d_qname); + } +#endif /* NOD_ENABLED */ + // cout<d_mdp.d_qname<<"\t"<getUsec()<<"\t"<