Skip to contentSkip to conversation

libdaq: add recipe

PATCH New Khem Raj 1 participant 4 messages Feb 21, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 libdaq: add recipe

From: Khawaja Shaheryar <[email protected]>

I am adding this recipe as snort3 depends on it.
snort3 recipe will be provided in next commit.
See more: https://github.com/snort3/libdaq

---
 ...01-example-Use-lm-for-the-fst-module.patch | 32 +++++++++++++++++++
 .../recipes-connectivity/daq/libdaq_git.bb    | 18 +++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/daq/libdaq/0001-example-Use-lm-for-the-fst-module.patch
 create mode 100644 meta-networking/recipes-connectivity/daq/libdaq_git.bb
meta-networking/recipes-connectivity/daq/libdaq/0001-example-Use-lm-for-the-fst-module.patch new file +32 -0
new file mode 100644
index 0000000000..7147c042a1
@@ -0,0 +1,32 @@
+From 9357da2a5a829f7a0620e6c19835a65b7b02a8fb Mon Sep 17 00:00:00 2001
+From: Khawaja Shaheryar <[email protected]>
+Date: Tue, 20 Feb 2024 21:03:26 +0500
+Subject: [PATCH] example: Use -lm for the fst module
+
+If -lm is not passed in Makefile.am, the following is seen
+| arm-yoe-linux-gnueabi-ld.lld: error: undefined symbol: ceilf
+| >>> referenced by math.h:632 (/usr/include/c++/v1/math.h:632)
+| >>>               libdaq_static_fst_la-daq_fst.o:(std::__1::pair<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<FstKey, FstNode*>, void*>*>, bool> std::__1::__hash_table<std::__1::__hash_value_type<FstKey, FstNode*>, std::__1::__unordered_map_hasher<FstKey, std::__1::__hash_value_type<FstKey, FstNode*>, FstKeyHash, std::__1::equal_to<FstKey>, true>, std::__1::__unordered_map_equal<FstKey, std::__1::__hash_value_type<FstKey, FstNode*>, std::__1::equal_to<FstKey>, FstKeyHash, true>, std::__1::allocator<std::__1::__hash_value_type<FstKey, FstNode*>>>::__emplace_unique_key_args<FstKey, std::__1::pair<FstKey const, FstNode*>>(FstKey const&, std::__1::pair<FstKey const, FstNode*>&&)) in archive ../modules/fst/.libs/libdaq_static_fst.a
+
+Upstream-Status: Pending
+
+Signed-off-by: Khawaja Shaheryar <[email protected]>
+---
+ example/Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/example/Makefile.am b/example/Makefile.am
+index 0d5ca31..1eaa9e8 100644
+--- a/example/Makefile.am
++++ b/example/Makefile.am
+@@ -31,6 +31,7 @@ endif
+ if BUILD_FST_MODULE
+ daqtest_static_CFLAGS += -DBUILD_FST_MODULE
+ daqtest_static_LDADD += ${top_builddir}/modules/fst/libdaq_static_fst.la $(DAQ_FST_LIBS)
++daqtest_static_LDFLAGS += -lm
+ endif
+ if BUILD_NETMAP_MODULE
+ daqtest_static_CFLAGS += -DBUILD_NETMAP_MODULE
+-- 
+2.34.1
+
meta-networking/recipes-connectivity/daq/libdaq_git.bb new file +18 -0
new file mode 100644
index 0000000000..19346124bf
@@ -0,0 +1,18 @@
+SUMMARY = "LibDAQ: The Data AcQuisition Library"
+DESCRIPTION = "LibDAQ is a pluggable abstraction layer for interacting with a data source (traditionally a network interface or network data plane)."
+HOMEPAGE = "http://www.snort.org"
+SECTION = "libs"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=79258250506422d064560a7b95b2d53e"
+
+DEPENDS = "libdnet libpcap"
+
+inherit autotools pkgconfig
+
+SRC_URI = "git://github.com/snort3/libdaq.git;protocol=https;branch=master \
+           file://0001-example-Use-lm-for-the-fst-module.patch"
+SRCREV = "c757aaae5a70d5bbb3239c5a16bca217a5aca651"
+
+S = "${WORKDIR}/git"
+
+FILES:${PN} += "${libdir}/daq/*.so"
Signature · 1 line
2.43.2
author
#1 lore raw

PATCH 2/4 snort: add snort3 initial recipe

From: Khawaja Shaheryar <[email protected]>

I am adding this recipe as snort2 is legacy now.
See more: https://github.com/snort3/snort3

---
 .../recipes-connectivity/snort/snort3_git.bb  | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/snort/snort3_git.bb
meta-networking/recipes-connectivity/snort/snort3_git.bb new file +34 -0
new file mode 100644
index 0000000000..f40a1d7d6f
@@ -0,0 +1,34 @@
+SUMMARY = "snort3"
+DESCRIPTION = "snort3 - a free lightweight network intrusion detection system for UNIX and Windows."
+HOMEPAGE = "http://www.snort.org/"
+SECTION = "net"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=78fa8ef966b48fbf9095e13cc92377c5"
+
+PV = "3+git${SRCPV}"
+
+DEPENDS = "flex hwloc libdaq libdnet libpcap libpcre libtirpc libunwind luajit zlib"
+
+SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master"
+SRCREV = "e1760a8dbb829bb3fcf1a340ab6cc4bb80a47ecd"
+
+S = "${WORKDIR}/git"
+
+PACKAGES =+ "${PN}-scripts"
+
+inherit cmake pkgconfig
+
+FILES:${PN} += "${libdir}/snort/daq/*.so"
+
+FILES:${PN}-scripts = "${bindir}/appid_detector_builder.sh"
+
+RDEPENDS:${PN}-scripts += "bash"
+
+# mips64/ppc/ppc64/riscv64/riscv32 is not supported in this release
+COMPATIBLE_HOST:mipsarchn32 = "null"
+COMPATIBLE_HOST:mipsarchn64 = "null"
+COMPATIBLE_HOST:powerpc = "null"
+COMPATIBLE_HOST:powerpc64 = "null"
+COMPATIBLE_HOST:powerpc64le = "null"
+COMPATIBLE_HOST:riscv64 = "null"
+COMPATIBLE_HOST:riscv32 = "null"
Signature · 1 line
2.43.2
author
#2 lore raw

PATCH 3/4 snort: Do not use llvm libunwind

In reply to Khem Raj

If llvm unwind is present then disable unwinding support since it will not have all unw_* functions eg. unw_strerror

---
 .../0001-cmake-Check-for-HP-libunwind.patch   | 33 +++++++++++++++++++
 .../recipes-connectivity/snort/snort3_git.bb  |  3 +-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-connectivity/snort/snort3/0001-cmake-Check-for-HP-libunwind.patch
meta-networking/recipes-connectivity/snort/snort3/0001-cmake-Check-for-HP-libunwind.patch new file +33 -0
new file mode 100644
index 0000000000..7b7a0d098f
@@ -0,0 +1,33 @@
+From 433a412fad2ab0383ac3c625d183a71684f2b97b Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 20 Feb 2024 15:35:14 -0800
+Subject: [PATCH] cmake: Check for HP libunwind
+
+This is to ensure that cmake does not detect LLVM unwinder, which
+can provide the support for some HP unwinder functionality but not all
+e.g. unw_strerror goes missing. By checking for libunwind-common.h in
+tests we ensure that this test passes only with HP libunwind.
+
+Upstream-Status: Inappropriate [OE-Specific]
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ cmake/FindLibunwind.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/FindLibunwind.cmake b/cmake/FindLibunwind.cmake
+index f66800a18..1ad66fc83 100644
+--- a/cmake/FindLibunwind.cmake
++++ b/cmake/FindLibunwind.cmake
+@@ -22,7 +22,7 @@ find_package(PkgConfig QUIET)
+ pkg_check_modules(PC_LIBUNWIND libunwind)
+ 
+ find_path(LIBUNWIND_INCLUDE_DIRS
+-    NAMES libunwind.h
++    NAMES libunwind-common.h
+     HINTS ${PC_LIBUNWIND_INCLUDE_DIRS}
+ )
+ 
+-- 
+2.43.2
+
meta-networking/recipes-connectivity/snort/snort3_git.bb +2 -1
index f40a1d7d6f..0f4a86f61e 100644
@@ -9,7 +9,8 @@ PV = "3+git${SRCPV}"
 
 DEPENDS = "flex hwloc libdaq libdnet libpcap libpcre libtirpc libunwind luajit zlib"
 
-SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master \
+           file://0001-cmake-Check-for-HP-libunwind.patch"
 SRCREV = "e1760a8dbb829bb3fcf1a340ab6cc4bb80a47ecd"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.43.2
author
#3 lore raw

PATCH 4/4 snort3: Fix contains reference to TMPDIR [buildpaths] warnings

In reply to Khem Raj

Fixes
WARNING: snort3-3+git-r0 do_package_qa: QA Issue: File /usr/lib/pkgconfig/snort.pc in package snort3-dev contains reference to TMPDIR [buildpaths]
WARNING: snort3-3+git-r0 do_package_qa: QA Issue: File /usr/src/debug/snort3/3+git/src/js_norm/pdf_tokenizer.cc in package snort3-src contains reference to TMPDIR File /usr/src/debug/snort3/3+git/src/js_norm/js_tokenizer.cc in package snort3-src contains reference to TMPDIR [buildpaths]

---
 .../0001-cmake-Pass-noline-flag-to-flex.patch | 31 +++++++++++++++++++
 .../recipes-connectivity/snort/snort3_git.bb  |  9 ++++--
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/snort/snort3/0001-cmake-Pass-noline-flag-to-flex.patch
meta-networking/recipes-connectivity/snort/snort3/0001-cmake-Pass-noline-flag-to-flex.patch new file +31 -0
new file mode 100644
index 0000000000..ec7b90cfb4
@@ -0,0 +1,31 @@
+From 417ed0045b3d04f539a8eb18b07a208c75f6c7e1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 20 Feb 2024 16:08:20 -0800
+Subject: [PATCH] cmake: Pass --noline flag to flex
+
+This ensures that line directive is not emitted into lexer output which
+could be absolute build paths, since these files end up in dbg packages
+this can be flagged as a build/packaging warning.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ cmake/configure_options.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/configure_options.cmake b/cmake/configure_options.cmake
+index f3673f399..fbd0bd2c3 100644
+--- a/cmake/configure_options.cmake
++++ b/cmake/configure_options.cmake
+@@ -28,7 +28,7 @@ if ( ENABLE_LARGE_PCAP )
+ endif ( ENABLE_LARGE_PCAP )
+ 
+ # Flex Lexer
+-set ( FLEX_FLAGS "-Ca" )
++set ( FLEX_FLAGS "-Ca --noline" )
+ 
+ # documentation
+ 
+-- 
+2.43.2
+
meta-networking/recipes-connectivity/snort/snort3_git.bb +7 -2
index 0f4a86f61e..4bc2395fae 100644
@@ -7,10 +7,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=78fa8ef966b48fbf9095e13cc92377c5"
 
 PV = "3+git${SRCPV}"
 
-DEPENDS = "flex hwloc libdaq libdnet libpcap libpcre libtirpc libunwind luajit zlib"
+DEPENDS = "flex-native hwloc libdaq libdnet libpcap libpcre libtirpc libunwind luajit zlib"
 
 SRC_URI = "git://github.com/snort3/snort3.git;protocol=https;branch=master \
-           file://0001-cmake-Check-for-HP-libunwind.patch"
+           file://0001-cmake-Check-for-HP-libunwind.patch \
+           file://0001-cmake-Pass-noline-flag-to-flex.patch"
 SRCREV = "e1760a8dbb829bb3fcf1a340ab6cc4bb80a47ecd"
 
 S = "${WORKDIR}/git"
@@ -19,6 +20,10 @@ PACKAGES =+ "${PN}-scripts"
 
 inherit cmake pkgconfig
 
+do_install:append() {
+    sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/pkgconfig/snort.pc
+}
+
 FILES:${PN} += "${libdir}/snort/daq/*.so"
 
 FILES:${PN}-scripts = "${bindir}/appid_detector_builder.sh"
Signature · 1 line
2.43.2