From 3382905befd23364989d941038bf7b1530fea0dc Mon Sep 17 00:00:00 2001 From: dergoegge Date: Tue, 12 Apr 2022 13:47:48 +0200 Subject: [net] Seed addr cache randomizer with port from binding address --- src/net.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index e8c131b5b0..3820ee1fd0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2801,6 +2801,9 @@ std::vector CConnman::GetAddresses(CNode& requestor, size_t max_addres uint64_t cache_id = GetDeterministicRandomizer(RANDOMIZER_ID_ADDRCACHE) .Write(requestor.ConnectedThroughNetwork()) .Write(local_socket_bytes.data(), local_socket_bytes.size()) + // For outbound connections, the port of the bound address is randomly + // assigned by the OS and would therefore not be useful for seeding. + .Write(requestor.IsInboundConn() ? requestor.addrBind.GetPort() : 0) .Finalize(); const auto current_time = GetTime(); auto r = m_addr_response_caches.emplace(cache_id, CachedAddrResponse{}); -- cgit v1.2.3