[meta-networking] ulogd2: Add recipe

Message ID 20211227195242.16740-1-alexk@zuma.ai
State New
Headers show
Series [meta-networking] ulogd2: Add recipe | expand

Commit Message

Alex Kiernan Dec. 27, 2021, 7:52 p.m. UTC
ulogd-2.x provides a flexible, almost universal logging daemon for
netfilter logging.  This encompasses both packet-based logging (logging
of policy violations) and flow-based logging, e.g. for accounting
purpose.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@zuma.ai>
---
 .../recipes-filter/ulogd2/ulogd2_2.0.7.bb     | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb

Patch

diff --git a/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb b/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb
new file mode 100644
index 000000000000..9c6d21954c22
--- /dev/null
+++ b/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb
@@ -0,0 +1,66 @@ 
+SUMMARY = "Userspace logging daemon for netfilter/iptables"
+DESCRIPTION = "ulogd-2.x provides a flexible, almost universal logging daemon for \
+netfilter logging.  This encompasses both packet-based logging (logging of \
+policy violations) and flow-based logging, e.g. for accounting purpose."
+HOMEPAGE = "https://www.netfilter.org/projects/ulogd/index.html"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b"
+
+DEPENDS = "libnfnetlink"
+
+PV .= "+git${SRCPV}"
+
+SRC_URI = "git://git.netfilter.org/ulogd2;branch=master"
+SRCREV = "1d9fd9d64b17b48dd0b38bdebb7086c88a649e1b"
+
+S = "${WORKDIR}/git"
+
+inherit autotools manpages pkgconfig
+
+PACKAGECONFIG ?= "dbi jansson nfacct nfct nflog pcap sqlite ulog"
+PACKAGECONFIG[dbi] = "--with-dbi,--without-dbi,libdbi"
+PACKAGECONFIG[jansson] = "--with-jansson,--without-jansson,jansson"
+PACKAGECONFIG[manpages] = ""
+# this needs work to be functional
+PACKAGECONFIG[mysql] = "--with-mysql,--without-mysql,"
+PACKAGECONFIG[nfacct] = "--enable-nfacct,--disable-nfacct,libnetfilter-acct"
+PACKAGECONFIG[nfct] = "--enable-nfct,--disable-nfct,libnetfilter-conntrack"
+PACKAGECONFIG[nflog] = "--enable-nflog,--disable-nflog,libnetfilter-log"
+PACKAGECONFIG[pcap] = "--with-pcap,--without-pcap,libpcap"
+# this needs work to be functional
+PACKAGECONFIG[pgsql] = "--with-pgsql,--without-pgsql,"
+PACKAGECONFIG[sqlite] = "--with-sqlite,--without-sqlite,sqlite3"
+PACKAGECONFIG[ulog] = "--enable-ulog,--disable-ulog"
+
+do_install:append () {
+	install -d ${D}${sysconfdir}
+	install -m 0644 ${B}/ulogd.conf ${D}${sysconfdir}/ulogd.conf
+
+	install -d ${D}${mandir}/mans85
+	install -m 0644 ${S}/ulogd.8 ${D}${mandir}/man8/ulogd.8
+}
+
+PACKAGES += "${PN}-plugins"
+ALLOW_EMPTY:${PN}-plugins = "1"
+
+PACKAGES_DYNAMIC += "^${PN}-plugin-.*$"
+NOAUTOPACKAGEDEBUG = "1"
+
+CONFFILES:${PN} = "${sysconfdir}/ulogd.conf"
+RRECOMMENDS:${PN} += "${PN}-plugins"
+
+FILES:${PN}-dbg += "${sbindir}/.debug"
+
+python split_ulogd_libs () {
+    libdir = d.expand('${libdir}/ulogd')
+    dbglibdir = os.path.join(libdir, '.debug')
+
+    split_packages = do_split_packages(d, libdir, r'^ulogd_.*\_([A-Z0-9]*).so', '${PN}-plugin-%s', 'ulogd2 %s plugin', prepend=True)
+    split_dbg_packages = do_split_packages(d, dbglibdir, r'^ulogd_.*\_([A-Z0-9]*).so', '${PN}-plugin-%s-dbg', 'ulogd2 %s plugin - Debugging files', prepend=True, extra_depends='${PN}-dbg')
+
+    if split_packages:
+        pn = d.getVar('PN')
+        d.setVar('RRECOMMENDS:' + pn + '-plugins', ' '.join(split_packages))
+        d.appendVar('RRECOMMENDS:' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages))
+}
+PACKAGESPLITFUNCS:prepend = "split_ulogd_libs "