From: Ensar Sarajčić Date: Thu, 6 Jun 2024 07:42:11 +0000 (+0200) Subject: Reduce nesting in NOD check X-Git-Tag: rec-5.2.0-alpha0~19^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19f6a24a496cc9198fc9c421c486dcf0b8812189;p=thirdparty%2Fpdns.git Reduce nesting in NOD check --- diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index f43314b2d1..511f46ca71 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -625,17 +625,18 @@ static bool nodCheckNewDomain(Logr::log_t nodlogger, const DNSName& dname) { bool ret = false; // First check the (sub)domain isn't ignored for NOD purposes - if (!g_nodDomainWL.check(dname)) { - // Now check the NODDB (note this is probabilistic so can have FNs/FPs) - if (g_nodDBp && g_nodDBp->isNewDomain(dname)) { - if (g_nodLog) { - // This should probably log to a dedicated log file - SLOG(g_log << Logger::Notice << "Newly observed domain nod=" << dname << endl, - nodlogger->info(Logr::Notice, "New domain observed")); - } - t_Counters.at(rec::Counter::nodCount)++; - ret = true; + if (g_nodDomainWL.check(dname)) { + return ret; + } + // Now check the NODDB (note this is probabilistic so can have FNs/FPs) + if (g_nodDBp && g_nodDBp->isNewDomain(dname)) { + if (g_nodLog) { + // This should probably log to a dedicated log file + SLOG(g_log << Logger::Notice << "Newly observed domain nod=" << dname << endl, + nodlogger->info(Logr::Notice, "New domain observed")); } + t_Counters.at(rec::Counter::nodCount)++; + ret = true; } return ret; }