Skip to content

Commit 4fe338a

Browse files
committed
Call CAddrMan::Good() on block-relay-only peer addresses
Being able to invoke Good() is important for address management (new vs tried table, tried table eviction via test-before-evict). We mitigate potential information leaks by not calling Connected() on these peer addresses.
1 parent daf5553 commit 4fe338a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/net_processing.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,14 +2407,8 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24072407
// empty and no one will know who we are, so these mechanisms are
24082408
// important to help us connect to the network.
24092409
//
2410-
// We also update the addrman to record connection success for
2411-
// these peers (which include OUTBOUND_FULL_RELAY and FEELER
2412-
// connections) so that addrman will have an up-to-date notion of
2413-
// which peers are online and available.
2414-
//
2415-
// We skip these operations for BLOCK_RELAY peers to avoid
2416-
// potentially leaking information about our BLOCK_RELAY
2417-
// connections via the addrman or address relay.
2410+
// We skip this for BLOCK_RELAY peers to avoid potentially leaking
2411+
// information about our BLOCK_RELAY connections via address relay.
24182412
if (fListen && !::ChainstateActive().IsInitialBlockDownload())
24192413
{
24202414
CAddress addr = GetLocalAddress(&pfrom.addr, pfrom.GetLocalServices());
@@ -2433,9 +2427,23 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24332427
// Get recent addresses
24342428
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::GETADDR));
24352429
pfrom.fGetAddr = true;
2430+
}
24362431

2437-
// Moves address from New to Tried table in Addrman, resolves
2438-
// tried-table collisions, etc.
2432+
if (!pfrom.IsInboundConn()) {
2433+
// For non-inbound connections, we update the addrman to record
2434+
// connection success so that addrman will have an up-to-date
2435+
// notion of which peers are online and available.
2436+
//
2437+
// While we strive to not leak information about block-relay-only
2438+
// connections via the addrman, not moving an address to the tried
2439+
// table is also potentially detrimental because new-table entries
2440+
// are subject to eviction in the event of addrman collisions. We
2441+
// mitigate the information-leak by never calling
2442+
// CAddrMan::Connected() on block-relay-only peers; see
2443+
// FinalizeNode().
2444+
//
2445+
// This moves an address from New to Tried table in Addrman,
2446+
// resolves tried-table collisions, etc.
24392447
m_connman.MarkAddressGood(pfrom.addr);
24402448
}
24412449

0 commit comments

Comments
 (0)