From 4f1a4cbccd784e25f7932f1d0293602ef7f3e814 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Thu, 4 Sep 2025 21:22:49 +0200 Subject: [PATCH] net: Quiet down logging when router doesn't support natpmp/pcp When the router doesn't support natpmp and PCP, one'd normally expect the UDP packet to be ignored, and hit a time out. This logs a warning that is already in the debug category. However, there's also the case in which sending an UDP packet causes a ICMP response. This is returned to user space as "connection refused" (despite UDP having no concept of connections). Move the warnings from `Send` and `Recv` to debug level too, to reduce log spam in that case. Closes #33301. --- src/common/pcp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/pcp.cpp b/src/common/pcp.cpp index 8ababab32f3..6733cb79ae1 100644 --- a/src/common/pcp.cpp +++ b/src/common/pcp.cpp @@ -230,7 +230,7 @@ std::optional> PCPSendRecv(Sock &sock, const std::string &p } // Dispatch packet to gateway. if (sock.Send(request.data(), request.size(), 0) != static_cast(request.size())) { - LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError())); + LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError())); return std::nullopt; // Network-level error, probably no use retrying. } @@ -251,7 +251,7 @@ std::optional> PCPSendRecv(Sock &sock, const std::string &p // Receive response. recvsz = sock.Recv(response, sizeof(response), MSG_DONTWAIT); if (recvsz < 0) { - LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError())); + LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError())); return std::nullopt; // Network-level error, probably no use retrying. } LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Received response of %d bytes: %s\n", protocol, recvsz, HexStr(std::span(response, recvsz)));