]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: count substituted remote in case of proxy protocol
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 17 Jun 2024 09:22:47 +0000 (11:22 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 18 Jun 2024 08:14:24 +0000 (10:14 +0200)
Other remote counts are already doing that

(cherry picked from commit a6f989d8cb1b26329a50925d6d7f0ef06d9572cd)

pdns/recursordist/pdns_recursor.cc
pdns/recursordist/rec-tcp.cc

index 3c5eb4ed3d9282fb0093241a38dafaab94a09f9e..7b2419fd886042385b3555e865522cdc76cd08b2 100644 (file)
@@ -2507,7 +2507,7 @@ static void handleNewUDPQuestion(int fileDesc, FDMultiplexer::funcparam_t& /* va
         }
       }
       if (t_remotes) {
-        t_remotes->push_back(fromaddr);
+        t_remotes->push_back(source);
       }
 
       if (t_allowFrom && !t_allowFrom->match(&mappedSource)) {
index 7d1a8bb3d1038d6b6c33060688eb8b674e8d1d99..efb08f8fd53287bf1da987e6e6029051b902c1e7 100644 (file)
@@ -565,6 +565,9 @@ static void handleRunningTCPQuestion(int fileDesc, FDMultiplexer::funcparam_t& v
           ++iter->second.stats.netmaskMatches;
         }
       }
+      if (t_remotes) {
+        t_remotes->push_back(conn->d_source);
+      }
       if (t_allowFrom && !t_allowFrom->match(&conn->d_mappedSource)) {
         if (!g_quiet) {
           SLOG(g_log << Logger::Error << "[" << g_multiTasker->getTid() << "] dropping TCP query from " << conn->d_mappedSource.toString() << ", address not matched by allow-from" << endl,
@@ -693,10 +696,6 @@ void handleNewTCPQuestion(int fileDesc, [[maybe_unused]] FDMultiplexer::funcpara
       return;
     }
 
-    if (t_remotes) {
-      t_remotes->push_back(addr);
-    }
-
     bool fromProxyProtocolSource = expectProxyProtocol(addr);
     ComboAddress mappedSource = addr;
     if (!fromProxyProtocolSource && t_proxyMapping) {