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.
This commit is contained in:
1 parent
e31956980e
commit
f2e3662e57
1 file changed
+5
-1
+5
-1
@@ -2256,7 +2256,11 @@ void CConnman::ThreadDNSAddressSeed()
|
|||||||
if (!resolveSource.SetInternal(host)) {
|
if (!resolveSource.SetInternal(host)) {
|
||||||
continue;
|
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)};
|
const auto addresses{LookupHost(host, nMaxIPs, true)};
|
||||||
if (!addresses.empty()) {
|
if (!addresses.empty()) {
|
||||||
for (const CNetAddr& ip : addresses) {
|
for (const CNetAddr& ip : addresses) {
|
||||||
|
|||||||
Reference in new issue
Block a user