Skip to contentSkip to conversation

libnfnetlink: enable native build

PATCH New Yi Zhao 1 participant 3 messages Jul 28, 2023

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/3 libnfnetlink: enable native build

Required by libnetfilter-queue native build.

---
 .../recipes-filter/libnfnetlink/libnfnetlink_1.0.2.bb           | 2 ++
 1 file changed, 2 insertions(+)
meta-networking/recipes-filter/libnfnetlink/libnfnetlink_1.0.2.bb +2 -0
index a43c345d5..277818561 100644
@@ -18,3 +18,5 @@ SRC_URI[md5sum] = "39d65185e2990562c64de05a08de8771"
 SRC_URI[sha256sum] = "b064c7c3d426efb4786e60a8e6859b82ee2f2c5e49ffeea640cfe4fe33cbc376"
 
 inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/3 libnetfilter-queue: enable native build

Required by daq native build.

---
 .../recipes-filter/libnetfilter/libnetfilter-queue_1.0.5.bb     | 2 ++
 1 file changed, 2 insertions(+)
meta-networking/recipes-filter/libnetfilter/libnetfilter-queue_1.0.5.bb +2 -0
index 580c29e1a..301dd86cf 100644
@@ -14,3 +14,5 @@ SRC_URI = "git://git.netfilter.org/libnetfilter_queue;branch=master \
 S = "${WORKDIR}/git"
 
 inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 3/3 daq: enable nfq module build

In reply to Yi Zhao

NFQ is the new and improved way to process iptables packets. Snort IPS mode requires this module in some cases.

Before the patch:

$ snort --daq-list
Available DAQ modules:
pcap(v3): readback live multi unpriv
ipfw(v3): live inline multi unpriv
dump(v3): readback live inline multi unpriv
afpacket(v5): live inline multi unpriv

After the patch:

$ snort  --daq-list
Available DAQ modules:
pcap(v3): readback live multi unpriv
nfq(v7): live inline multi
ipfw(v3): live inline multi unpriv
dump(v3): readback live inline multi unpriv
afpacket(v5): live inline multi unpriv

Also update 0001-correct-the-location-of-unistd.h.patch to fix build with musl.

---
 .../recipes-connectivity/daq/daq_2.0.7.bb     |  4 +--
 ...001-correct-the-location-of-unistd.h.patch | 27 +++++++++++++++----
 2 files changed, 24 insertions(+), 7 deletions(-)
meta-networking/recipes-connectivity/daq/daq_2.0.7.bb +2 -2
index 14d809f51..c5499ffee 100644
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=f9ce51a65dd738dc1ae631d8b21c40e0"
 
 PARALLEL_MAKE = ""
 
-DEPENDS = "libpcap libpcre libdnet bison-native"
+DEPENDS = "libpcap libpcre libdnet bison-native libnetfilter-queue"
 
 SRC_URI = "http://fossies.org/linux/misc/daq-${PV}.tar.gz \
            file://disable-run-test-program-while-cross-compiling.patch \
@@ -19,7 +19,7 @@ SRC_URI[sha256sum] = "bdc4e5a24d1ea492c39ee213a63c55466a2e8114b6a9abed609927ae13
 #
 # never look to /usr/local lib while cross compiling
 
-EXTRA_OECONF = "--disable-nfq-module --disable-ipq-module --includedir=${includedir} \
+EXTRA_OECONF = "--enable-nfq-module --disable-ipq-module --includedir=${includedir} \
     --with-libpcap-includes=${STAGING_INCDIR} --with-dnet-includes=${STAGING_LIBDIR}"
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
meta-networking/recipes-connectivity/daq/files/0001-correct-the-location-of-unistd.h.patch +22 -5
index 38dae2099..7587d4433 100644
@@ -1,14 +1,15 @@
-From 10e7d4e4bfcb70344d18f0d4ce36068475747f25 Mon Sep 17 00:00:00 2001
+From b7d54de51553f6d09906c355bd0dd326890c8fe4 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Wed, 29 Mar 2017 15:59:43 -0700
 Subject: [PATCH] correct the location of unistd.h
 
-Signed-off-by: Khem Raj <[email protected]>
----
 Upstream-Status: Pending
 
+Signed-off-by: Khem Raj <[email protected]>
+---
  os-daq-modules/daq_ipfw.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ os-daq-modules/daq_nfq.c  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/os-daq-modules/daq_ipfw.c b/os-daq-modules/daq_ipfw.c
 index 016beb0..c2a4175 100644
@@ -26,6 +27,22 @@ index 016beb0..c2a4175 100644
  
  #include <netinet/in.h>
  #include <sys/socket.h>
+diff --git a/os-daq-modules/daq_nfq.c b/os-daq-modules/daq_nfq.c
+index 33021c0..4de94b6 100644
+--- a/os-daq-modules/daq_nfq.c
++++ b/os-daq-modules/daq_nfq.c
+@@ -24,10 +24,10 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <unistd.h>
+ 
+ #include <sys/types.h>
+ #include <sys/time.h>
+-#include <sys/unistd.h>
+ 
+ #include <netinet/ip.h>
+ 
 -- 
-2.12.1
+2.25.1
 
Signature · 1 line
2.25.1