diff options
author | fanquake <fanquake@gmail.com> | 2020-01-23 09:52:38 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-01-23 10:07:40 +0800 |
commit | 8b67698420e23db20cfbb9228ca01a68c8ddc10c (patch) | |
tree | 16089f70ee4847e523c75dc225b5e4f20057e410 | |
parent | a05d14d4a00eceb03c14ca04de131116075b10f4 (diff) | |
parent | c89611ebd33a86c0fe14adecc100065f16ea16da (diff) |
Merge #17974: [0.18] net: Log to net category for exceptions in ProcessMessagesv0.18-final
c89611ebd33a86c0fe14adecc100065f16ea16da net: Log to net category for exceptions in ProcessMessages (Wladimir J. van der Laan)
Pull request description:
Backport of #17762, currently only backported to 0.19.
This seems like something we should opportunistically plug in case wiseguys decide it's a vector to exploit to try and fill people's disks.
ACKs for top commit:
practicalswift:
ACK c89611ebd33a86c0fe14adecc100065f16ea16da
MarcoFalke:
ACK c89611ebd33a86c0fe14adecc100065f16ea16d, checked that this is a cherry-pick from 0.19 💐
Tree-SHA512: e48daf64a14d98a78cadd0774a597e5833a1ff19f05527dfc42f3cc38532c1c3bd1acd925c8e0c484e01fbc8c604ee2bcfc0cec0333e9af570b103a6241b657d
-rw-r--r-- | src/net_processing.cpp | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ab30104c47..e967abafc9 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3090,35 +3090,10 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter return false; if (!pfrom->vRecvGetData.empty()) fMoreWork = true; - } - catch (const std::ios_base::failure& e) - { - if (m_enable_bip61) { - connman->PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message"))); - } - if (strstr(e.what(), "end of data")) { - // Allow exceptions from under-length message on vRecv - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught, normally caused by a message being shorter than its stated length\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "size too large")) { - // Allow exceptions from over-long size - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "non-canonical ReadCompactSize()")) { - // Allow exceptions from non-canonical encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "Superfluous witness record")) { - // Allow exceptions from illegal witness encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else if (strstr(e.what(), "Unknown transaction optional data")) { - // Allow exceptions from unknown witness encoding - LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what()); - } else { - PrintExceptionContinue(&e, "ProcessMessages()"); - } - } - catch (const std::exception& e) { - PrintExceptionContinue(&e, "ProcessMessages()"); + } catch (const std::exception& e) { + LogPrint(BCLog::NET, "%s(%s, %u bytes): Exception '%s' (%s) caught\n", __func__, SanitizeString(strCommand), nMessageSize, e.what(), typeid(e).name()); } catch (...) { - PrintExceptionContinue(nullptr, "ProcessMessages()"); + LogPrint(BCLog::NET, "%s(%s, %u bytes): Unknown exception caught\n", __func__, SanitizeString(strCommand), nMessageSize); } if (!fRet) { |