Skip to content

Commit 647cdb4

Browse files
committed
Merge #33311: net: Quiet down logging when router doesn't support natpmp/pcp
4f1a4cb net: Quiet down logging when router doesn't support natpmp/pcp (laanwj) Pull request description: 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 message that is already in the debug category. However, there's also the case in which sending an UDP packet causes a ICMP response (type 3, code 3 "port unreachable"). 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. ACKs for top commit: willcl-ark: utACK 4f1a4cb sipa: utACK 4f1a4cb davidgumberg: Tested ACK 4f1a4cb achow101: ACK 4f1a4cb darosior: utACK 4f1a4cb mzumsande: utACK 4f1a4cb Tree-SHA512: 2c99a5679720482ece47af33616b6b207509fb58ba1962a1c2d30f8d0e68554f8f5ef25224313d93f4c5a1cc702183fcf8e6119abc411209c9884119ef680aad
2 parents e1ce0c5 + 4f1a4cb commit 647cdb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/pcp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
230230
}
231231
// Dispatch packet to gateway.
232232
if (sock.Send(request.data(), request.size(), 0) != static_cast<ssize_t>(request.size())) {
233-
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
233+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
234234
return std::nullopt; // Network-level error, probably no use retrying.
235235
}
236236

@@ -251,7 +251,7 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
251251
// Receive response.
252252
recvsz = sock.Recv(response, sizeof(response), MSG_DONTWAIT);
253253
if (recvsz < 0) {
254-
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
254+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
255255
return std::nullopt; // Network-level error, probably no use retrying.
256256
}
257257
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Received response of %d bytes: %s\n", protocol, recvsz, HexStr(std::span(response, recvsz)));

0 commit comments

Comments
 (0)