mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
p2p: allow CIDR notation in DNS blocklist
This commit is contained in:
parent
25670398b1
commit
b5667c9f6c
1 changed files with 15 additions and 6 deletions
|
@ -2027,15 +2027,24 @@ namespace nodetool
|
||||||
boost::split(ips, record, boost::is_any_of(";"));
|
boost::split(ips, record, boost::is_any_of(";"));
|
||||||
for (const auto &ip: ips)
|
for (const auto &ip: ips)
|
||||||
{
|
{
|
||||||
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
|
if (ip.empty())
|
||||||
if (!parsed_addr)
|
continue;
|
||||||
|
auto subnet = net::get_ipv4_subnet_address(ip);
|
||||||
|
if (subnet)
|
||||||
{
|
{
|
||||||
MWARNING("Invalid IP address from DNS blocklist: " << ip << " - " << parsed_addr.error());
|
block_subnet(*subnet, DNS_BLOCKLIST_LIFETIME);
|
||||||
++bad;
|
++good;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
|
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
|
||||||
++good;
|
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)
|
if (good > 0)
|
||||||
|
|
Loading…
Reference in a new issue