aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-01-20 15:18:39 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2021-03-30 08:57:04 +0000
commit57edfd78fde75d1532acebbf33446a3e3f902c36 (patch)
tree8c95cdd666db10f66daec6fb35284e3b61115057 /src/p2p/net_node.inl
parentMerge pull request #7476 (diff)
downloadmonero-57edfd78fde75d1532acebbf33446a3e3f902c36.tar.xz
p2p: allow CIDR notation in DNS blocklist
Diffstat (limited to '')
-rw-r--r--src/p2p/net_node.inl17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index cf0b1db10..4571743a2 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -2002,15 +2002,22 @@ namespace nodetool
{
if (ip.empty())
continue;
+ auto subnet = net::get_ipv4_subnet_address(ip);
+ if (subnet)
+ {
+ block_subnet(*subnet, DNS_BLOCKLIST_LIFETIME);
+ ++good;
+ continue;
+ }
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(ip, 0);
- if (!parsed_addr)
+ if (parsed_addr)
{
- MWARNING("Invalid IP address from DNS blocklist: " << ip << " - " << parsed_addr.error());
- ++bad;
+ block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
+ ++good;
continue;
}
- block_host(*parsed_addr, DNS_BLOCKLIST_LIFETIME, true);
- ++good;
+ MWARNING("Invalid IP address or subnet from DNS blocklist: " << ip << " - " << parsed_addr.error());
+ ++bad;
}
}
if (good > 0)