]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Reduce nesting in NOD check
authorEnsar Sarajčić <dev@ensarsarajcic.com>
Thu, 6 Jun 2024 07:42:11 +0000 (09:42 +0200)
committerEnsar Sarajčić <dev@ensarsarajcic.com>
Thu, 6 Jun 2024 07:42:11 +0000 (09:42 +0200)
pdns/recursordist/pdns_recursor.cc

index f43314b2d1d1e4bfcf38047ef12cf6c28782a04c..511f46ca712d4148ca8acd38cf413c3680e3e4ab 100644 (file)
@@ -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;
 }