1
0
Fork 0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-05-04 02:36:17 +02:00

Added option to disable pcap build

This commit is contained in:
Pavel Odintsov 2023-04-02 19:57:29 +01:00
parent 0227a923ad
commit 77134e1b1b
5 changed files with 22 additions and 4 deletions

View File

@ -40,6 +40,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --std=c++2a")
# With this flag we can enable GoBGP build via console: cmake .. -DENABLE_GOBGP_SUPPORT=ON
option(ENABLE_GOBGP_SUPPORT "Enable GoBGP support build" ON)
# It can be disabled this way: cmake .. -DENABLE_PCAP_SUPPORT=OFF
option(ENABLE_PCAP_SUPPORT "Enable PCAP support" ON)
# On some platforms like Fedora we need to explicitly link with libabseil / libabsl.
# We do not use it directly but gRPC uses it for libgpr and we need to link with absl explicitly to avoid linker errors like this:
# libgpr.so: undefined reference to symbol '_ZN4absl12lts_202103245Mutex4LockEv'
@ -462,6 +465,10 @@ if (LINK_WITH_ABSL)
# TODO: check that we actually found it. Otherwise trigger fatal erorr
endif()
if (ENABLE_PCAP_SUPPORT)
add_definitions(-DENABLE_PCAP)
endif()
if (ENABLE_GOBGP_SUPPORT)
add_definitions(-DENABLE_GOBGP)
add_library(gobgp_action STATIC actions/gobgp_action.cpp)

View File

@ -54,7 +54,11 @@
// Plugins
#include "netflow_plugin/netflow_collector.hpp"
#ifdef ENABLE_PCAP
#include "pcap_plugin/pcap_collector.hpp"
#endif
#include "sflow_plugin/sflow_collector.hpp"
#ifdef NETMAP_PLUGIN
@ -1885,9 +1889,11 @@ int main(int argc, char** argv) {
packet_capture_plugin_thread_group.add_thread(new boost::thread(start_netflow_collection, process_packet));
}
#ifdef ENABLE_PCAP
if (enable_pcap_collection) {
packet_capture_plugin_thread_group.add_thread(new boost::thread(start_pcap_collection, process_packet));
}
#endif
// Wait for all threads in capture thread group
packet_capture_plugin_thread_group.join_all();

View File

@ -20,7 +20,11 @@
// Plugins
#include "netflow_plugin/netflow_collector.hpp"
#ifdef ENABLE_PCAP
#include "pcap_plugin/pcap_collector.hpp"
#endif
#include "sflow_plugin/sflow_collector.hpp"
#ifdef NETMAP_PLUGIN

View File

@ -1,5 +1,4 @@
#ifndef PCAP_PLUGIN_H
#define PCAP_PLUGIN_H
#pragma once
#include "../fastnetmon_types.hpp"
#include <iostream>
@ -7,5 +6,3 @@
void start_pcap_collection(process_packet_pointer func_ptr);
void stop_pcap_collection();
std::string get_pcap_stats();
#endif

View File

@ -14,7 +14,11 @@
#include "fastnetmon_types.h"
#include "libpatricia/patricia.hpp"
#include "netflow_plugin/netflow_collector.h"
#ifdef ENABLE_PCAP
#include "pcap_plugin/pcap_collector.h"
#endif
#include "sflow_plugin/sflow_collector.h"
#ifdef FASTNETMON_ENABLE_AFPACKET