aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-12-26 13:42:37 -0800
committerAlexander Blair <snipa@jagtech.io>2020-12-26 13:42:37 -0800
commit5402121323ef115498a4852f11906872eb65bb95 (patch)
treec840cf49b98f46996921ce9ca96fb720883b864c /src/p2p/net_node.inl
parentMerge pull request #7173 (diff)
parentban lists may now include subnets (diff)
downloadmonero-5402121323ef115498a4852f11906872eb65bb95.tar.xz
Merge pull request #7180
56748e1d7 ban lists may now include subnets (moneromooo-monero)
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 6016b243f..bf053f0f2 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -489,13 +489,19 @@ namespace nodetool
std::istringstream iss(banned_ips);
for (std::string line; std::getline(iss, line); )
{
+ auto subnet = net::get_ipv4_subnet_address(line);
+ if (subnet)
+ {
+ block_subnet(*subnet, std::numeric_limits<time_t>::max());
+ continue;
+ }
const expect<epee::net_utils::network_address> parsed_addr = net::get_network_address(line, 0);
- if (!parsed_addr)
+ if (parsed_addr)
{
- MERROR("Invalid IP address: " << line << " - " << parsed_addr.error());
+ block_host(*parsed_addr, std::numeric_limits<time_t>::max());
continue;
}
- block_host(*parsed_addr, std::numeric_limits<time_t>::max());
+ MERROR("Invalid IP address or IPv4 subnet: " << line);
}
}