diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/daemon/command_parser_executor.cpp | 10 | ||||
| -rw-r--r-- | src/p2p/net_node.inl | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 20c906141..087a4e48b 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -696,6 +696,16 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args) std::ifstream ifs(ban_list_path.string()); for (std::string line; std::getline(ifs, line); ) { + // ignore comments after '#' character + const size_t pound_idx = line.find('#'); + if (pound_idx != std::string::npos) + line.resize(pound_idx); + + // trim whitespace and ignore empty lines + boost::trim(line); + if (line.empty()) + continue; + auto subnet = net::get_ipv4_subnet_address(line); if (subnet) { diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 71f5393e8..08cd70cae 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -531,6 +531,16 @@ namespace nodetool std::istringstream iss(banned_ips); for (std::string line; std::getline(iss, line); ) { + // ignore comments after '#' character + const size_t pound_idx = line.find('#'); + if (pound_idx != std::string::npos) + line.resize(pound_idx); + + // trim whitespace and ignore empty lines + boost::trim(line); + if (line.empty()) + continue; + auto subnet = net::get_ipv4_subnet_address(line); if (subnet) { |
