Compare commits
1 Commits
developmen
...
fresh-ndpi
Author | SHA1 | Date | |
---|---|---|---|
surtur | fda01cb7e5 |
17
.drone.yml
17
.drone.yml
|
@ -62,13 +62,19 @@ steps:
|
|||
- export MAKEFLAGS="$MAKEFLAGS -j$(nproc)" && printf "$MAKEFLAGS\n"
|
||||
- git clone https://github.com/ntop/nDPI.git /drone/nDPI
|
||||
- cd /drone/nDPI
|
||||
- git checkout 1.7
|
||||
- ./autogen.sh
|
||||
- ./configure
|
||||
- make
|
||||
- make install
|
||||
depends_on: [deps]
|
||||
|
||||
- name: apply patch nDPI
|
||||
pull: if-not-exists
|
||||
image: immawanderer/archlinux-cdev:latest
|
||||
commands:
|
||||
- git apply src/patches/dev-ndpi.patch
|
||||
depends_on: [deps]
|
||||
|
||||
- name: build fastnetmon
|
||||
pull: if-not-exists
|
||||
image: immawanderer/archlinux-cdev:latest
|
||||
|
@ -84,7 +90,7 @@ steps:
|
|||
- make clean fastnetmon all
|
||||
when:
|
||||
status: [success, failure]
|
||||
depends_on: [build-install nDPI]
|
||||
depends_on: [build-install nDPI, apply patch nDPI]
|
||||
|
||||
- name: print shared object deps
|
||||
pull: if-not-exists
|
||||
|
@ -158,6 +164,12 @@ trigger:
|
|||
event: [push, pull_request]
|
||||
|
||||
steps:
|
||||
- name: apply patch nDPI
|
||||
pull: always
|
||||
image: immawanderer/fedora-cpp:linux-amd64
|
||||
commands:
|
||||
- git apply src/patches/dev-ndpi.patch
|
||||
|
||||
- name: build fastnetmon
|
||||
pull: if-not-exists
|
||||
image: immawanderer/fedora-cpp:linux-amd64
|
||||
|
@ -176,6 +188,7 @@ steps:
|
|||
- make clean fastnetmon all
|
||||
when:
|
||||
status: [success]
|
||||
depends_on: [apply patch nDPI]
|
||||
|
||||
- name: print shared object deps
|
||||
pull: if-not-exists
|
||||
|
|
|
@ -290,16 +290,16 @@ if (ENABLE_DPI_SUPPORT)
|
|||
|
||||
add_library(fast_dpi STATIC fast_dpi.cpp)
|
||||
|
||||
set(NDPI_INCLUDE_DIRS "/usr/local/include/libndpi-1.7.1" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/include/libndpi-1.7.1" "/usr/include/ndpi")
|
||||
set(NDPI_INCLUDE_DIRS "/usr/include/ndpi" "/usr/local/include/libndpi-1.7.1" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/include/libndpi-1.7.1")
|
||||
|
||||
find_library(NDPI_LIBRARIES NAMES ndpi PATHS "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib" "/usr/local/lib" NO_DEFAULT_PATH)
|
||||
find_library(NDPI_LIBRARIES NAMES ndpi PATHS "/usr/lib" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib" "/usr/local/lib" NO_DEFAULT_PATH)
|
||||
|
||||
if (NOT NDPI_LIBRARIES)
|
||||
message(FATAL_ERROR "Could not find nDPI library")
|
||||
endif()
|
||||
|
||||
link_directories("/usr/local/lib" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib")
|
||||
include_directories("/usr/local/include/libndpi-1.7.1" "/usr/include/ndpi" ${NDPI_INCLUDE_DIRS})
|
||||
link_directories("/usr/lib" "/usr/local/lib" "${FASTNETMON_LIBRARIES_GLOBAL_PATH}/ndpi/lib")
|
||||
include_directories("/usr/include/ndpi" "/usr/local/include/libndpi-1.7.1" ${NDPI_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(-DENABLE_DPI)
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
src/fast_dpi.cpp | 16 ++++++++--------
|
||||
src/fast_dpi.h | 3 ++-
|
||||
2 files changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/fast_dpi.cpp b/src/fast_dpi.cpp
|
||||
index 7e9f7bf..e0e8d6f 100644
|
||||
--- a/src/fast_dpi.cpp
|
||||
+++ b/src/fast_dpi.cpp
|
||||
@@ -32,17 +32,17 @@ void debug_printf(u_int32_t protocol, void* id_struct, ndpi_log_level_t log_leve
|
||||
}
|
||||
|
||||
struct ndpi_detection_module_struct* init_ndpi() {
|
||||
- u_int32_t detection_tick_resolution = 1000;
|
||||
-
|
||||
- struct ndpi_detection_module_struct* my_ndpi_struct =
|
||||
-#if NDPI_MAJOR >= 2
|
||||
- ndpi_init_detection_module();
|
||||
+ // logic here was incorrectly reverted and ndpi 2.* is way old anyway
|
||||
+#if NDPI_MAJOR <= 2
|
||||
+ struct ndpi_detection_module_struct* my_ndpi_struct = ndpi_init_detection_module();
|
||||
#else
|
||||
- ndpi_init_detection_module(detection_tick_resolution, malloc, free, debug_printf);
|
||||
+ // new init after https://github.com/ntop/nDPI/commit/8181d63a
|
||||
+ // Added ndpi_init_detection_module() API preferences
|
||||
+ ndpi_init_prefs prefs = ndpi_no_prefs;
|
||||
+ struct ndpi_detection_module_struct* my_ndpi_struct = ndpi_init_detection_module(prefs);
|
||||
#endif
|
||||
-
|
||||
if (my_ndpi_struct == NULL) {
|
||||
- // printf("Can't init nDPI");
|
||||
+ printf("Can't init nDPI");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff --git a/src/fast_dpi.h b/src/fast_dpi.h
|
||||
index a502643..f92977e 100644
|
||||
--- a/src/fast_dpi.h
|
||||
+++ b/src/fast_dpi.h
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef FAST_DPI_H
|
||||
#define FAST_DPI_H
|
||||
|
||||
-#include "libndpi/ndpi_api.h"
|
||||
+// newer version are not installed in libndpi anymore
|
||||
+#include "ndpi/ndpi_api.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
struct ndpi_detection_module_struct* init_ndpi();
|
Loading…
Reference in New Issue