1
0
Fork 0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-05-10 00:16:25 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Cho 65f06e7b7d
Merge fad8757b89 into dfc161008a 2024-01-12 17:53:33 +03:00
Pavel Odintsov dfc161008a Reworked default systemd unit file to run FastNetMon under regular non root user and switched logging to journald 2024-01-10 15:25:04 +00:00
Michael Cho fad8757b89
Prioritize find_package config mode for Protobuf
This sets correct C++ standard for newer Protobuf installations as
FindProtobuf module only sets cxx_std_11
2023-12-26 12:56:45 -05:00
3 changed files with 19 additions and 15 deletions

View File

@ -594,26 +594,26 @@ if (ENABLE_GOBGP_SUPPORT)
target_link_libraries(gobgp_action absl::base absl::synchronization)
endif()
# By default use module supplied by cmake to search for Protobuf
set(FIND_PACKAGE_MODE_PROTOBUF "MODULE")
if (DO_NOT_USE_SYSTEM_LIBRARIES_FOR_BUILD)
# We add our custom path to Protobuf to top of search_list used by find_package: https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html
# This approach has advantage over Protobuf_DIR which requires us to set direct path to cmake folder of custom built dependency
# which resides in vendor specific folder with name lib which may be lib64 on CentOS platforms:
# protobuf_21_12/lib/cmake/protobuf or protobuf_21_12/lib64/cmake/protobuf on CentOS
list(APPEND CMAKE_PREFIX_PATH ${PROTOCOL_BUFFERS_CUSTOM_INSTALL_PATH})
# Switch to use to configuration supplied by custom Protobuf installation as it may be better
set(FIND_PACKAGE_MODE_PROTOBUF "CONFIG")
# Apparently it's required to set this flag because without this flag set it cannot find protoc when custom library path is in use
# https://github.com/protocolbuffers/protobuf/issues/1931
set(protobuf_MODULE_COMPATIBLE true)
endif()
# https://cmake.org/cmake/help/latest/module/FindProtobuf.html
find_package(Protobuf ${FIND_PACKAGE_MODE_PROTOBUF} REQUIRED)
# Apparently it's required to set this flag because without this flag set it cannot find protoc when custom library path is in use
# https://github.com/protocolbuffers/protobuf/issues/1931
set(protobuf_MODULE_COMPATIBLE true)
# Switch to use to configuration supplied by custom Protobuf installation as it may be better
find_package(Protobuf CONFIG)
if (NOT Protobuf_FOUND)
# Fall back to module supplied by cmake to search for Protobuf
# https://cmake.org/cmake/help/latest/module/FindProtobuf.html
find_package(Protobuf MODULE REQUIRED)
endif()
if (Protobuf_FOUND)
message(STATUS "Found Protobuf ${Protobuf_VERSION}")

View File

@ -5,10 +5,14 @@ After=network.target remote-fs.target
[Service]
Type=simple
ExecStart=@CMAKE_INSTALL_SBINDIR@/fastnetmon
ExecStart=@CMAKE_INSTALL_SBINDIR@/fastnetmon --log_to_console
User=fastnetmon
Group=fastnetmon
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
# We need it to use AF_PACKET and AF_XDP when run under non root user
AmbientCapabilities=CAP_NET_RAW CAP_IPC_LOCK
[Install]
WantedBy=multi-user.target

View File

@ -11,7 +11,7 @@ Group=fastnetmon
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
# We need it to use AF_PACKET when run under non root user
# We need it to use AF_PACKET and AF_XDP when run under non root user
AmbientCapabilities=CAP_NET_RAW CAP_IPC_LOCK
[Install]