aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-03-09 21:52:08 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2016-03-09 21:52:17 +0100
commitc8d2473e6cb042e7275a10c49d3f6a4a91bf0166 (patch)
tree8ef1bc702734c284946e2ae91fe9729a182dc6a7 /src
parent386f4385ab04b0b2c3d47bddc0dc0f2de7354964 (diff)
parent9988554fc76250b1f695c616341c8dd3278c928b (diff)
downloadbitcoin-c8d2473e6cb042e7275a10c49d3f6a4a91bf0166.tar.xz
Merge #7642: Avoid "Unknown command" messages when receiving getaddr on outbound c…
9988554 No "Unknown command" for getaddr command. (R E Broadley)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index babdff54ef..378c454cd2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5064,13 +5064,18 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
- // This asymmetric behavior for inbound and outbound connections was introduced
- // to prevent a fingerprinting attack: an attacker can send specific fake addresses
- // to users' AddrMan and later request them by sending getaddr messages.
- // Making nodes which are behind NAT and can only make outgoing connections ignore
- // the getaddr message mitigates the attack.
- else if ((strCommand == NetMsgType::GETADDR) && (pfrom->fInbound))
+ else if (strCommand == NetMsgType::GETADDR)
{
+ // This asymmetric behavior for inbound and outbound connections was introduced
+ // to prevent a fingerprinting attack: an attacker can send specific fake addresses
+ // to users' AddrMan and later request them by sending getaddr messages.
+ // Making nodes which are behind NAT and can only make outgoing connections ignore
+ // the getaddr message mitigates the attack.
+ if (!pfrom->fInbound) {
+ LogPrint("net", "Ignoring \"getaddr\" from outbound connection. peer=%d\n", pfrom->id);
+ return true;
+ }
+
pfrom->vAddrToSend.clear();
vector<CAddress> vAddr = addrman.GetAddr();
BOOST_FOREACH(const CAddress &addr, vAddr)