snort3: build against gperftools-runtime
authorJohn Audia <[email protected]>
Sun, 25 Feb 2024 00:06:45 +0000 (19:06 -0500)
committerTianling Shen <[email protected]>
Tue, 27 Feb 2024 05:26:13 +0000 (13:26 +0800)
Should provide increases in snort3 performance thanks to thread-
caching malloc provided by gperftools.  Avg CPU usage is down.
Another user reported higher throughput achieved with snort3
compiled with this on samba transfers on system with CPU-limited
snort3 performance.[1]

1. https://forum.openwrt.org/t/some-help-with-a-makefile-gperftools/165656/22

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <[email protected]>
(cherry picked from commit 4295bd7f45943b92e6e12ba91aac5f701b2da5a3)

net/snort3/Makefile

index 29507d6cde9029c6895d0a13f9c56fa74dcfa80f..7582a162517e9af612c4d781039569d06e574777 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=snort3
 PKG_VERSION:=3.1.81.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/snort3/snort3/archive/refs/tags/
@@ -25,7 +25,12 @@ define Package/snort3
   SUBMENU:=Firewall
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libstdcpp +libdaq3 +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +libhwloc +libtirpc +luajit +libatomic
+  DEPENDS:= \
+           +(TARGET_x86||TARGET_x86_64):hyperscan-runtime \
+           +(TARGET_x86||TARGET_x86_64):gperftools-runtime \
+           +libstdcpp +libdaq3 +libdnet +libopenssl +libpcap +libpcre +libpthread \
+           +libuuid +zlib +libhwloc +libtirpc @HAS_LUAJIT_ARCH +luajit +libatomic \
+           +kmod-nft-queue +liblzma +ucode +ucode-mod-fs +ucode-mod-uci
   TITLE:=Lightweight Network Intrusion Detection System
   URL:=http://www.snort.org/
   MENU:=1
@@ -39,6 +44,18 @@ define Package/snort3/description
   attacks.
 endef
 
+# Hyperscan and gperftools only builds for x86
+ifdef CONFIG_TARGET_x86_64
+       CMAKE_OPTIONS += -DHS_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/hs
+endif
+
+# Hyperscan and gperftools only builds for x86
+ifdef CONFIG_TARGET_x86_64
+       CMAKE_OPTIONS += -DHS_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/hs \
+                        -DENABLE_TCMALLOC=ON \
+                        -DTCMALLOC_LIBRARIES=$(STAGING_DIR)/usr/lib/libtcmalloc.so
+endif
+
 CMAKE_OPTIONS += \
        -DUSE_TIRPC:BOOL=YES \
        -DENABLE_STATIC_DAQ:BOOL=NO \