mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 02:18:52 +00:00
p2p: allow CIDR notation in DNS blocklist
This commit is contained in:
parent
a7663f4ba1
commit
57edfd78fd
@ -2002,15 +2002,22 @@ namespace nodetool
|
|||||||
{
|
{
|
||||||
if (ip.empty())
|
if (ip.empty())
|
||||||
continue;
|
continue;
|
||||||
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
|
auto subnet = net::get_ipv4_subnet_address(ip);
|
||||||
if (!parsed_addr)
|
if (subnet)
|
||||||
{
|
{
|
||||||
MWARNING("Invalid IP address from DNS blocklist: " << ip << " - " << parsed_addr.error());
|
block_subnet(*subnet, DNS_BLOCKLIST_LIFETIME);
|
||||||
++bad;
|
++good;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
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);
|
block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
|
||||||
++good;
|
++good;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MWARNING("Invalid IP address or subnet from DNS blocklist: " << ip << " - " << parsed_addr.error());
|
||||||
|
++bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (good > 0)
|
if (good > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user