Skip to content

Commit f2e3662

Browse files
committed
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.
1 parent e319569 commit f2e3662

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/net.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,11 @@ void CConnman::ThreadDNSAddressSeed()
22562256
if (!resolveSource.SetInternal(host)) {
22572257
continue;
22582258
}
2259-
unsigned int nMaxIPs = 256; // Limits number of IPs learned from a DNS seed
2259+
// Limit number of IPs learned from a single DNS seed. This limit exists to prevent the results from
2260+
// one DNS seed from dominating AddrMan. Note that the number of results from a UDP DNS query is
2261+
// bounded to 33 already, but it is possible for it to use TCP where a larger number of results can be
2262+
// returned.
2263+
unsigned int nMaxIPs = 32;
22602264
const auto addresses{LookupHost(host, nMaxIPs, true)};
22612265
if (!addresses.empty()) {
22622266
for (const CNetAddr& ip : addresses) {

0 commit comments

Comments
 (0)