mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
Merge pull request #7332
57edfd7
p2p: allow CIDR notation in DNS blocklist (moneromooo-monero)
This commit is contained in:
commit
39ce27b5d5
1 changed files with 13 additions and 6 deletions
|
@ -2002,15 +2002,22 @@ namespace nodetool
|
|||
{
|
||||
if (ip.empty())
|
||||
continue;
|
||||
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
|
||||
if (!parsed_addr)
|
||||
auto subnet = net::get_ipv4_subnet_address(ip);
|
||||
if (subnet)
|
||||
{
|
||||
MWARNING("Invalid IP address from DNS blocklist: " << ip << " - " << parsed_addr.error());
|
||||
++bad;
|
||||
block_subnet(*subnet, DNS_BLOCKLIST_LIFETIME);
|
||||
++good;
|
||||
continue;
|
||||
}
|
||||
block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
|
||||
++good;
|
||||
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
|
||||
if (parsed_addr)
|
||||
{
|
||||
block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
|
||||
++good;
|
||||
continue;
|
||||
}
|
||||
MWARNING("Invalid IP address or subnet from DNS blocklist: " << ip << " - " << parsed_addr.error());
|
||||
++bad;
|
||||
}
|
||||
}
|
||||
if (good > 0)
|
||||
|
|
Loading…
Reference in a new issue