Skip to content

Commit 3382905

Browse files
committed
[net] Seed addr cache randomizer with port from binding address
1 parent f10e80b commit 3382905

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/net.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,6 +2801,9 @@ std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addres
28012801
uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE)
28022802
.Write(requestor.ConnectedThroughNetwork())
28032803
.Write(local_socket_bytes.data(), local_socket_bytes.size())
2804+
// For outbound connections, the port of the bound address is randomly
2805+
// assigned by the OS and would therefore not be useful for seeding.
2806+
.Write(requestor.IsInboundConn() ? requestor.addrBind.GetPort() : 0)
28042807
.Finalize();
28052808
const auto current_time = GetTime<std::chrono::microseconds>();
28062809
auto r = m_addr_response_caches.emplace(cache_id, CachedAddrResponse{});

0 commit comments

Comments
 (0)