diff --git a/net-mgmt/fastnetmon/Makefile b/net-mgmt/fastnetmon/Makefile index 19ee82010c8f..0b9b0512a3db 100644 --- a/net-mgmt/fastnetmon/Makefile +++ b/net-mgmt/fastnetmon/Makefile @@ -1,63 +1,62 @@ PORTNAME= fastnetmon DISTVERSIONPREFIX= v -DISTVERSION= 1.2.7 -PORTREVISION= 17 +DISTVERSION= 1.2.8 CATEGORIES= net-mgmt security MAINTAINER= farrokhi@FreeBSD.org COMMENT= Very fast DDoS analyzer with sflow/netflow/mirror support WWW= https://fastnetmon.com LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/../LICENSE BROKEN_armv6= does not build: invokes x86 assembler BROKEN_armv7= does not build: invokes x86 assembler LIB_DEPENDS= libboost_regex.so:devel/boost-libs \ liblog4cpp.so:devel/log4cpp \ libmongoc-1.0.so:devel/mongo-c-driver \ libbson-1.0.so:devel/libbson \ libcapnp.so:devel/capnproto \ libgrpc.so:devel/grpc \ libprotobuf.so:devel/protobuf \ libabsl_base.so:devel/abseil \ libhiredis.so:databases/hiredis USES= cmake compiler:c++20-lang localbase:ldflags pkgconfig ssl USE_GITHUB= yes GH_ACCOUNT= pavel-odintsov WRKSRC_SUBDIR= src USE_RC_SUBR= ${PORTNAME} USERS= ${PORTNAME} GROUPS= ${PORTNAME} PORTDOCS= * CFLAGS_i386= -march=i586 CXXFLAGS+= -D_GNU_SOURCE CMAKE_OFF= SET_ABSOLUTE_INSTALL_PATH CMAKE_ON= ENABLE_NETMAP_SUPPORT \ LINK_WITH_ABSL OPTIONS_DEFINE= DOCS post-patch: @${REINPLACE_CMD} -e 's|/etc/networks|${PREFIX}/etc/networks|g' \ -e 's|/var/run|/var/run/${PORTNAME}|g' ${WRKSRC}/fastnetmon.conf @${REINPLACE_CMD} -e 's|/etc/|${PREFIX}/etc/|g' ${WRKSRC}/man/fastnetmon.8 post-install: ${INSTALL_DATA} ${WRKSRC}/fastnetmon.conf ${STAGEDIR}${PREFIX}/etc/fastnetmon.conf.sample ${INSTALL_DATA} ${WRKSRC}/networks_list ${STAGEDIR}${PREFIX}/etc/networks_list.sample ${INSTALL_DATA} ${WRKSRC}/networks_whitelist ${STAGEDIR}${PREFIX}/etc/networks_whitelist.sample ${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon ${STAGEDIR}/var/log/fastnetmon_attacks ${INSTALL_SCRIPT} ${WRKSRC}/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin/notify_about_attack.sh.sample post-install-DOCS-on: cd ${WRKSRC}/../ && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR} .include diff --git a/net-mgmt/fastnetmon/distinfo b/net-mgmt/fastnetmon/distinfo index b1e024e750c0..6556e4a5deab 100644 --- a/net-mgmt/fastnetmon/distinfo +++ b/net-mgmt/fastnetmon/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1721758522 -SHA256 (pavel-odintsov-fastnetmon-v1.2.7_GH0.tar.gz) = c21fcbf970214dd48ee8aa11e6294e16bea86495085315e7b370a84b316d0af9 -SIZE (pavel-odintsov-fastnetmon-v1.2.7_GH0.tar.gz) = 1443577 +TIMESTAMP = 1740071207 +SHA256 (pavel-odintsov-fastnetmon-v1.2.8_GH0.tar.gz) = d16901b00963f395241c818d02ad2751f14e33fd32ed3cb3011641ab680e0d01 +SIZE (pavel-odintsov-fastnetmon-v1.2.8_GH0.tar.gz) = 1476794 diff --git a/net-mgmt/fastnetmon/files/patch-dynamic__binary__buffer.hpp b/net-mgmt/fastnetmon/files/patch-dynamic__binary__buffer.hpp new file mode 100644 index 000000000000..2253d27f342d --- /dev/null +++ b/net-mgmt/fastnetmon/files/patch-dynamic__binary__buffer.hpp @@ -0,0 +1,59 @@ +--- dynamic_binary_buffer.hpp.orig 2024-12-14 12:46:40 UTC ++++ dynamic_binary_buffer.hpp +@@ -8,9 +8,21 @@ class dynamic_binary_buffer_t { + // std::cout << "Default constructor called" << std::endl; + } + +- // Explicitly removed it as we need to implement it properly when needed +- dynamic_binary_buffer_t(dynamic_binary_buffer_t&& that) = delete; ++ dynamic_binary_buffer_t(dynamic_binary_buffer_t&& source) noexcept { ++ // Just copy all field values from source and zeroify it ++ this->internal_data_shift = source.internal_data_shift; ++ source.internal_data_shift = 0; + ++ this->byte_storage = source.byte_storage; ++ source.byte_storage = nullptr; ++ ++ this->maximum_internal_storage_size = source.maximum_internal_storage_size; ++ source.maximum_internal_storage_size = 0; ++ ++ this->errors_occured = source.errors_occured; ++ source.errors_occured = false; ++ } ++ + // We should set maximum buffer size here. + // TODO: add ability to relocate memory of we need more memory + bool set_maximum_buffer_size_in_bytes(ssize_t size) { +@@ -155,21 +167,21 @@ class dynamic_binary_buffer_t { + } + + // Return full size (with non initialized data region too) +- uint32_t get_full_size() { ++ uint32_t get_full_size() const { + return maximum_internal_storage_size; + } + + // Return only used memory region +- size_t get_used_size() { ++ size_t get_used_size() const { + return internal_data_shift; + } + +- const uint8_t* get_pointer() { ++ const uint8_t* get_pointer() const { + return byte_storage; + } + + // If we have any issues with it +- bool is_failed() { ++ bool is_failed() const { + return errors_occured; + } + +@@ -180,3 +192,6 @@ class dynamic_binary_buffer_t { + // If any errors occurred in any time when we used this buffer + bool errors_occured = false; + }; ++ ++static_assert(std::is_move_constructible_v); ++static_assert(std::is_nothrow_move_constructible_v); diff --git a/net-mgmt/fastnetmon/files/patch-fast__library.cpp b/net-mgmt/fastnetmon/files/patch-fast__library.cpp index 2bb536102148..99192022b423 100644 --- a/net-mgmt/fastnetmon/files/patch-fast__library.cpp +++ b/net-mgmt/fastnetmon/files/patch-fast__library.cpp @@ -1,55 +1,55 @@ ---- fast_library.cpp.orig 2024-07-01 20:01:34 UTC +--- fast_library.cpp.orig 2024-12-14 12:46:40 UTC +++ fast_library.cpp -@@ -1087,15 +1087,13 @@ std::string dns_lookup(std::string domain_name) { +@@ -1094,15 +1094,13 @@ std::string dns_lookup(std::string domain_name) { std::string dns_lookup(std::string domain_name) { try { - boost::asio::io_service io_service; - boost::asio::ip::tcp::resolver resolver(io_service); + boost::asio::io_context io_context; + boost::asio::ip::tcp::resolver resolver(io_context); - boost::asio::ip::tcp::resolver::query query(domain_name, ""); + auto results = resolver.resolve(domain_name, ""); - for (boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query); - i != boost::asio::ip::tcp::resolver::iterator(); ++i) { - boost::asio::ip::tcp::endpoint end = *i; - return end.address().to_string(); + for (const auto& entry : results) { + return entry.endpoint().address().to_string(); } } catch (std::exception& e) { return ""; -@@ -1421,7 +1419,7 @@ bool validate_ipv6_or_ipv4_host(const std::string host +@@ -1428,7 +1426,7 @@ bool validate_ipv6_or_ipv4_host(const std::string host boost::system::error_code ec; // Try to build it from string representation - boost::asio::ip::address::from_string(host, ec); + boost::asio::ip::make_address(host, ec); // If we failed to parse it if (ec) { -@@ -1528,7 +1526,7 @@ bool execute_web_request_secure(std::string address, +@@ -1535,7 +1533,7 @@ bool execute_web_request_secure(std::string address, return false; } - auto end_point = resolver.resolve(boost::asio::ip::tcp::resolver::query{ host, port }, ec); + auto end_point = resolver.resolve(host, port, ec); if (ec) { logger << log4cpp::Priority::ERROR << "Could not resolve peer address in execute_web_request " << ec; -@@ -1692,11 +1690,11 @@ bool execute_web_request(std::string address, +@@ -1699,11 +1697,11 @@ bool execute_web_request(std::string address, // Normal boost::asio setup // std::string const host = "178.62.227.110"; - boost::asio::io_service ios; + boost::asio::io_context ios; boost::asio::ip::tcp::resolver r(ios); boost::asio::ip::tcp::socket sock(ios); - auto end_point = r.resolve(boost::asio::ip::tcp::resolver::query{ host, port }, ec); + auto end_point = r.resolve(host, port, ec); if (ec) { error_text = "Could not resolve peer address in execute_web_request " + ec.message(); diff --git a/net-mgmt/fastnetmon/files/patch-grpc b/net-mgmt/fastnetmon/files/patch-grpc deleted file mode 100644 index 5e38fa96c2fb..000000000000 --- a/net-mgmt/fastnetmon/files/patch-grpc +++ /dev/null @@ -1,48 +0,0 @@ -Obtained from: https://github.com/pavel-odintsov/fastnetmon/commit/a9163b6e0e6e5a7b87f85b89873fe547eaed4af7 - ---- fastnetmon_api_client.cpp.orig 2024-07-01 20:01:34 UTC -+++ fastnetmon_api_client.cpp -@@ -90,10 +90,6 @@ class FastnetmonClient { - std::unique_ptr stub_; - }; - --void silent_logging_function(gpr_log_func_args* args) { -- // We do not want any logging here --} -- - int main(int argc, char** argv) { - std::string supported_commands_list = "ban, unban, get_banlist"; - -@@ -101,8 +97,6 @@ int main(int argc, char** argv) { - std::cerr << "Please provide command as argument, supported commands: " << supported_commands_list << std::endl; - return 1; - } -- -- gpr_set_log_function(silent_logging_function); - - // Instantiate the client. It requires a channel, out of which the actual RPCs - // are created. This channel models a connection to an endpoint (in this case, ---- fastnetmon.cpp.orig 2024-07-01 20:01:34 UTC -+++ fastnetmon.cpp -@@ -472,10 +472,6 @@ void interruption_signal_handler(int signal_number); - void interruption_signal_handler(int signal_number); - - #ifdef FASTNETMON_API --void silent_logging_function(gpr_log_func_args* args) { -- // We do not want any logging here --} -- - // We could not define this variable in top of the file because we should define class before - FastnetmonApiServiceImpl api_service; - -@@ -1749,10 +1745,6 @@ int main(int argc, char** argv) { - ifs.close(); - std::filesystem::remove(fastnetmon_platform_configuration.backtrace_path); - } -- --#ifdef FASTNETMON_API -- gpr_set_log_function(silent_logging_function); --#endif - - // Set default ban configuration - init_global_ban_settings();