meta-google: recipes-google: nftables: Import from gBMC
Initial recipes-google/nftables code from gBMC.
Google-Bug-Id: 179618498
Upstream: 8ac594bdf054082ca6dbe35c4345759fe4c31669
Signed-off-by: Willy Tu <wltu@google.com>
Change-Id: Ic768cd1ffeec5831063c9a0f5cdbc8fdcd36a862
diff --git a/meta-google/recipes-google/nftables/files/nftables.service b/meta-google/recipes-google/nftables/files/nftables.service
new file mode 100644
index 0000000..7130dea
--- /dev/null
+++ b/meta-google/recipes-google/nftables/files/nftables.service
@@ -0,0 +1,11 @@
+[Unit]
+Before=network-pre.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/bash -c 'echo /etc/nftables/*.rules | xargs -n 1 nft -f'
+ExecStop=/bin/bash -c 'nft flush ruleset'
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-google/recipes-google/nftables/nftables-systemd.bb b/meta-google/recipes-google/nftables/nftables-systemd.bb
new file mode 100644
index 0000000..24d3e82
--- /dev/null
+++ b/meta-google/recipes-google/nftables/nftables-systemd.bb
@@ -0,0 +1,17 @@
+SUMMARY = "nftables systemd wrapper"
+DESCRIPTION = "nftables systemd wrapper"
+PR = "r1"
+PV = "1.0"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit systemd
+
+SRC_URI += "file://nftables.service"
+SYSTEMD_SERVICE_${PN} += "nftables.service"
+
+do_install() {
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/nftables.service ${D}${systemd_system_unitdir}
+}