diff --git a/src/plugins/input/dpdk/CMakeLists.txt b/src/plugins/input/dpdk/CMakeLists.txt index be84e39d..cef3eb21 100644 --- a/src/plugins/input/dpdk/CMakeLists.txt +++ b/src/plugins/input/dpdk/CMakeLists.txt @@ -16,6 +16,11 @@ add_library(ipfixprobe-input-dpdk MODULE ../parser/parser.cpp ../parser/parser.hpp ) +option(DPDK_PCAP_ENABLED "Enable dpdk pcap using secondary application (dpdk-pdump)" OFF) + +if (DPDK_PCAP_ENABLED) + target_compile_definitions(ipfixprobe-input-dpdk PRIVATE DPDK_PCAP_ENABLED) +endif() set_target_properties(ipfixprobe-input-dpdk PROPERTIES CXX_VISIBILITY_PRESET hidden diff --git a/src/plugins/input/dpdk/src/dpdk.cpp b/src/plugins/input/dpdk/src/dpdk.cpp index 55687e3b..a2653a1c 100644 --- a/src/plugins/input/dpdk/src/dpdk.cpp +++ b/src/plugins/input/dpdk/src/dpdk.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef DPDK_PCAP_ENABLED +#include +#endif + #define MEMPOOL_CACHE_SIZE 256 namespace ipxp { @@ -125,6 +129,10 @@ void DpdkCore::configureEal(const std::string& ealParams) if (rte_eal_init(args.size(), args.data()) < 0) { rte_exit(EXIT_FAILURE, "Cannot initialize RTE_EAL: %s\n", rte_strerror(rte_errno)); } +#ifdef DPDK_PCAP_ENABLED + std::cerr << "Initializing DPDK packet dump framework." << std::endl; + rte_pdump_init(); // Initialize packet dump framework +#endif } uint16_t DpdkCore::getRxQueueId() noexcept diff --git a/src/plugins/storage/cache/src/cache.cpp b/src/plugins/storage/cache/src/cache.cpp index 04893f9a..d4b242d5 100644 --- a/src/plugins/storage/cache/src/cache.cpp +++ b/src/plugins/storage/cache/src/cache.cpp @@ -434,8 +434,11 @@ int NHTFlowCache::put_pkt(Packet& pkt) flow = m_flow_table[flow_index]; uint8_t flw_flags = source_flow ? flow->m_flow.src_tcp_flags : flow->m_flow.dst_tcp_flags; - if ((pkt.tcp_flags & 0x02) && (flw_flags & (0x01 | 0x04))) { - // Flows with FIN or RST TCP flags are exported when new SYN packet arrives + if (!m_source_optimization_enabled && (pkt.tcp_flags & 0x02) && (flw_flags & (0x01 | 0x04))) { + // Flows with FIN or RST TCP flags are exported when new SYN packet arrives. + // When source optimization is enabled this case do not make any sence as the code would + // trigger a record push even thow we are trying to collect all data to a destination with + // in actvie timeout. m_flow_table[flow_index]->m_flow.end_reason = FLOW_END_EOF; export_flow(flow_index); put_pkt(pkt);