From 55c8a848d3ee160c2b4630180b62d534c2b70788 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 8 Nov 2023 13:13:55 +0100 Subject: Fixed missing deflate during flow event json serializing. * caused by recently added serializing some nDPI data even packet processing is still ongoing Signed-off-by: Toni Uhlig --- CMakeLists.txt | 3 +++ nDPId.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21020d5e7..91ead84cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,9 @@ set(NDPID_DEPS_INC "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/dependencies" "${CMAKE_SOURCE_DIR}/dependencies/jsmn" "${CMAKE_SOURCE_DIR}/dependencies/uthash/src") +if(CMAKE_CROSSCOMPILING) + add_definitions("-DCROSS_COMPILATION=1") +endif() if(ENABLE_MEMORY_PROFILING) message(WARNING "ENABLE_MEMORY_PROFILING should not be used in production environments.") add_definitions("-DENABLE_MEMORY_PROFILING=1" diff --git a/nDPId.c b/nDPId.c index 16ef9230d..2ee694838 100644 --- a/nDPId.c +++ b/nDPId.c @@ -2744,7 +2744,21 @@ static void jsonize_flow_event(struct nDPId_reader_thread * const reader_thread, } else if (flow_ext->flow_basic.state == FS_INFO) { - struct nDPId_flow const * const flow = (struct nDPId_flow *)flow_ext; + struct nDPId_flow * const flow = (struct nDPId_flow *)flow_ext; + +#ifdef ENABLE_ZLIB + if (nDPId_options.enable_zlib_compression != 0 && flow->info.detection_data_compressed_size > 0) + { + workflow->current_compression_diff -= flow->info.detection_data_compressed_size; + int ret = detection_data_inflate(flow); + if (ret <= 0) + { + workflow->current_compression_diff += flow->info.detection_data_compressed_size; + logger(1, "zLib decompression failed with error code: %d", ret); + return; + } + } +#endif if (flow->info.detection_completed != 0) { -- cgit v1.2.3