aboutsummaryrefslogtreecommitdiff
path: root/src/p2p
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-22 02:11:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-22 02:12:58 +0000
commite35bbb1e88e52f123c3e2f1d2bdbe2f704d0abe9 (patch)
treecd9822812e7dd818256c5f49c1ebc32caedde117 /src/p2p
parentMerge pull request #7152 (diff)
downloadmonero-e35bbb1e88e52f123c3e2f1d2bdbe2f704d0abe9.tar.xz
ban lists may now include subnets
Diffstat (limited to 'src/p2p')
-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 128d17155..0bd971f92 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -481,13 +481,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);
}
}