From 41314d1a5b0b3fdf76e6edb4a8e69b72da45e01e Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 3 Aug 2022 21:36:39 +0200 Subject: [PATCH 1/3] Fix ndpi-netfilter2 compilation on ARM --- ndpi-netfilter2/Makefile | 20 +++++-------------- ndpi-netfilter2/patches/outline-atomics.patch | 10 ++++++++++ .../patches/skbuff-check_fix.patch | 11 ++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 ndpi-netfilter2/patches/outline-atomics.patch create mode 100644 ndpi-netfilter2/patches/skbuff-check_fix.patch diff --git a/ndpi-netfilter2/Makefile b/ndpi-netfilter2/Makefile index d218d7daa..0f737dbab 100644 --- a/ndpi-netfilter2/Makefile +++ b/ndpi-netfilter2/Makefile @@ -39,29 +39,19 @@ define Package/iptables-mod-ndpi/description nDPI is a ntop-maintained superset of the popular OpenDPI library endef -#CONFIGURE_CMD = ./autogen.sh -#CONFIGURE_ARGS += --with-pic -MAKE_PATH := ndpi-netfilter +CONFIGURE_CMD=./autogen.sh +CONFIGURE_ARGS += --with-pic + +MAKE_PATH:=ndpi-netfilter MAKE_FLAGS += \ KERNEL_DIR="$(LINUX_DIR)" \ MODULES_DIR="$(TARGET_MODULES_DIR)" \ ARCH="$(LINUX_KARCH)" \ CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC)" \ NDPI_PATH=$(PKG_BUILD_DIR)/ndpi-netfilter -define Build/Configure - cd $(PKG_BUILD_DIR) && \ - CC="" ./autogen.sh \ - --host="$(GNU_TARGET_NAME)" -# --with-pic \ -# CFLAGS="$(TARGET_CFLAGS)" \ -# HOST_CFLAGS="$(BUILD_CFLAGS)" \ -# BUILD_CPPFLAGS="$(TARGET_CPPLAGS)" \ -# BUILD_CFLAGS="$(TARGET_CFLAGS)" \ -# BUILD_LDFLAGS="$(TARGET_LDFLAGS)" -endef - define Build/Compile (cd $(PKG_BUILD_DIR)/src/lib &&\ gcc -g -O2 -fPIC -DPIC -DNDPI_LIB_COMPILATION -I../../src/include/ -I../../src/lib/third_party/include/ ndpi_network_list_compile.c -o ndpi_network_list_compile &&\ diff --git a/ndpi-netfilter2/patches/outline-atomics.patch b/ndpi-netfilter2/patches/outline-atomics.patch new file mode 100644 index 000000000..9fda12412 --- /dev/null +++ b/ndpi-netfilter2/patches/outline-atomics.patch @@ -0,0 +1,10 @@ +--- a/ndpi-netfilter/src/Makefile 2022-08-03 21:27:52.321058402 +0200 ++++ b/ndpi-netfilter/src/Makefile 2022-08-03 21:28:27.572452447 +0200 +@@ -5,6 +5,7 @@ + ccflags-y += -I${src}/${NDPI_SRC}/include -I${src}/${NDPI_SRC}/lib -I${src}/../libre -I${src}/${NDPI_SRC}/lib/third_party/include + ccflags-y += -DHAVE_CONFIG_H -DNDPI_LIB_COMPILATION -DOPENDPI_NETFILTER_MODULE -DNDPI_DETECTION_SUPPORT_IPV6 -g + ccflags-y += -Wno-declaration-after-statement ++ccflags-y += -mno-outline-atomics + #ccflags-y += -Wshadow-local + # Needed for pahole + #ccflags-y += -femit-struct-debug-detailed=any diff --git a/ndpi-netfilter2/patches/skbuff-check_fix.patch b/ndpi-netfilter2/patches/skbuff-check_fix.patch new file mode 100644 index 000000000..ccc90c3ab --- /dev/null +++ b/ndpi-netfilter2/patches/skbuff-check_fix.patch @@ -0,0 +1,11 @@ +--- a/ndpi-netfilter/src/Makefile 2022-08-03 19:15:39.849630013 +0200 ++++ b/ndpi-netfilter/src/Makefile 2022-08-03 19:15:57.481336123 +0200 +@@ -13,7 +13,7 @@ + KERNEL_DIR := /lib/modules/$(shell uname -r)/build + endif + +-ifeq ($(shell grep -qc userid $(KERNEL_DIR)/source/include/linux/skbuff.h),1) ++ifeq ($(shell grep -qc userid $(KERNEL_DIR)/include/linux/skbuff.h),1) + ccflags-y += -DUSE_HACK_USERID=1 + endif + From d5c8604783ae7d6146b66c8daa8bf6b89741373d Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 4 Aug 2022 08:34:13 +0200 Subject: [PATCH 2/3] Disable outline atomics only for ARM64 --- ndpi-netfilter2/patches/outline-atomics.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ndpi-netfilter2/patches/outline-atomics.patch b/ndpi-netfilter2/patches/outline-atomics.patch index 9fda12412..bcb33a7fc 100644 --- a/ndpi-netfilter2/patches/outline-atomics.patch +++ b/ndpi-netfilter2/patches/outline-atomics.patch @@ -1,10 +1,12 @@ --- a/ndpi-netfilter/src/Makefile 2022-08-03 21:27:52.321058402 +0200 +++ b/ndpi-netfilter/src/Makefile 2022-08-03 21:28:27.572452447 +0200 -@@ -5,6 +5,7 @@ +@@ -5,6 +5,9 @@ ccflags-y += -I${src}/${NDPI_SRC}/include -I${src}/${NDPI_SRC}/lib -I${src}/../libre -I${src}/${NDPI_SRC}/lib/third_party/include ccflags-y += -DHAVE_CONFIG_H -DNDPI_LIB_COMPILATION -DOPENDPI_NETFILTER_MODULE -DNDPI_DETECTION_SUPPORT_IPV6 -g ccflags-y += -Wno-declaration-after-statement -+ccflags-y += -mno-outline-atomics ++ifeq ($(ARCH),arm64) ++ ccflags-y += -mno-outline-atomics ++endif #ccflags-y += -Wshadow-local # Needed for pahole #ccflags-y += -femit-struct-debug-detailed=any From b58311efbf0a24cc3f54f1afdf112e5786915fd1 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 4 Aug 2022 14:08:29 +0200 Subject: [PATCH 3/3] Fix ndpi-netfilter compilation on 5.4 --- ndpi-netfilter2/Makefile | 1 + ndpi-netfilter2/patches/outline-atomics.patch | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ndpi-netfilter2/Makefile b/ndpi-netfilter2/Makefile index 0f737dbab..13ebc5f14 100644 --- a/ndpi-netfilter2/Makefile +++ b/ndpi-netfilter2/Makefile @@ -48,6 +48,7 @@ MAKE_FLAGS += \ KERNEL_DIR="$(LINUX_DIR)" \ MODULES_DIR="$(TARGET_MODULES_DIR)" \ ARCH="$(LINUX_KARCH)" \ + KERNEL_RELEASE="$(KERNEL_PATCHVER)" \ CROSS_COMPILE="$(TARGET_CROSS)" \ CC="$(TARGET_CC)" \ NDPI_PATH=$(PKG_BUILD_DIR)/ndpi-netfilter diff --git a/ndpi-netfilter2/patches/outline-atomics.patch b/ndpi-netfilter2/patches/outline-atomics.patch index bcb33a7fc..ef7f6fd5f 100644 --- a/ndpi-netfilter2/patches/outline-atomics.patch +++ b/ndpi-netfilter2/patches/outline-atomics.patch @@ -1,11 +1,13 @@ --- a/ndpi-netfilter/src/Makefile 2022-08-03 21:27:52.321058402 +0200 +++ b/ndpi-netfilter/src/Makefile 2022-08-03 21:28:27.572452447 +0200 -@@ -5,6 +5,9 @@ +@@ -5,6 +5,11 @@ ccflags-y += -I${src}/${NDPI_SRC}/include -I${src}/${NDPI_SRC}/lib -I${src}/../libre -I${src}/${NDPI_SRC}/lib/third_party/include ccflags-y += -DHAVE_CONFIG_H -DNDPI_LIB_COMPILATION -DOPENDPI_NETFILTER_MODULE -DNDPI_DETECTION_SUPPORT_IPV6 -g ccflags-y += -Wno-declaration-after-statement ++ifeq ($(KERNEL_RELEASE),5.15) +ifeq ($(ARCH),arm64) + ccflags-y += -mno-outline-atomics ++endif +endif #ccflags-y += -Wshadow-local # Needed for pahole