Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

106.2. nftables-1.1.7

Netfilter packet filtering and classification framework, and the nft tool the firewall is written in

Version 1.1.7, release 1
Shelf network — Host network configuration and connection management: links, Wi-Fi, DHCP, DNS forwarding, time, modems, firewall and VPN
Phase 41_system (System), 310 of 1047 in build order
Licence GPL-2.0-only AND GPL-2.0-or-later
Homepage https://netfilter.org/projects/nftables/
Build time 0.4 SBU
Installed size 1.4 MiB in 29 files
Recipe ports/core/network/nftables/kpkgbuild

About

nftables is the kernel’s packet filtering framework and nft, the program that loads and lists its rules. The KDOS firewall is written in it: /etc/init.d/25_nftables.sh checks /etc/nftables.conf and the drop-ins in /etc/nftables.d/ with nft -c and loads them at boot, and kdos-powerd rewrites 50-kdos-services.nft and reloads the ruleset when an administrator opens or closes a service. The shipped ruleset and how it is applied are in The firewall.

Container networking uses it as well. netavark, podman’s network backend, runs with its nftables firewall driver and drives nft in JSON mode. networkmanager, libvirt, dnsmasq and wireguard-tools depend on this port too.

Sources

Dependencies

Depends on: libmnl, libnftnl, gmp, readline, jansson, bison, flex.

Required by (5): dnsmasq, libvirt, netavark, networkmanager, wireguard-tools.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install nftables'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/network/nftables.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/network/nftables
echo 'a6fbf060d8d4fff001517a2b94f356bb4366bfbf0ba366366f9d27cc38caa58f  nftables-1.1.7.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/nftables
SRC=$SRC_ROOT/nftables-1.1.7
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nftables-1.1.7.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

./configure \
	--prefix=/usr \
	--sysconfdir=/etc \
	--libdir=/usr/lib \
	--with-cli=readline \
	--with-json \
	--without-xtables \
	--enable-extended-parser-errors \
	--enable-man-doc \
	--disable-debug \
	--disable-static
make
make DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/nftables, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf nftables-1.1.7-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/nftables, and runs the triggers its paths call for.

Contents

Installed programs: nft.

Installed libraries: libnftables.so.

Installed directories: /etc/nftables, /usr/include/nftables, /usr/share/doc/nftables, /usr/share/licenses/nftables, /usr/share/nftables.

Short descriptions

nft Administration tool of the nftables framework for packet filtering and classification
libnftables.pc Netfilter nf_tables user library