From 19f6a24a496cc9198fc9c421c486dcf0b8812189 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 6 Jun 2024 09:42:11 +0200 Subject: [PATCH] Reduce nesting in NOD check --- pdns/recursordist/pdns_recursor.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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; } -- 2.47.2