diff options
author | laanwj <126646+laanwj@users.noreply.github.com> | 2024-04-11 14:38:32 +0200 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2024-04-11 14:43:30 +0200 |
commit | f2e3662e57eca1330962faf38ff428a564d50a11 (patch) | |
tree | 511c0fd77876b613597fe9acb320083a44ba89a4 /src/net.cpp | |
parent | e31956980e16ad3d619022e572bdf55a4eae8716 (diff) | |
download | bitcoin-f2e3662e57eca1330962faf38ff428a564d50a11.tar.xz |
net: Decrease nMaxIPs when learning from DNS seeds
Limit number of IPs learned from a single DNS seed to 32, to prevent the results from
one DNS seed from dominating AddrMan. Note that the number of results from a UDP DNS query is
bounded to 33 already, but it is possible for it to use TCP where a potentially enormous
number of results can be returned.
Closes #16070.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index e388f05b03..3e959c187c 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2256,7 +2256,11 @@ void CConnman::ThreadDNSAddressSeed() if (!resolveSource.SetInternal(host)) { continue; } - unsigned int nMaxIPs = 256; // Limits number of IPs learned from a DNS seed + // Limit number of IPs learned from a single DNS seed. This limit exists to prevent the results from + // one DNS seed from dominating AddrMan. Note that the number of results from a UDP DNS query is + // bounded to 33 already, but it is possible for it to use TCP where a larger number of results can be + // returned. + unsigned int nMaxIPs = 32; const auto addresses{LookupHost(host, nMaxIPs, true)}; if (!addresses.empty()) { for (const CNetAddr& ip : addresses) { |