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

103.7. netavark-2.1.0

Container network stack (network backend for Podman, Rust)

Version 2.1.0, release 1
Shelf containers — Container runtimes, image tools, container networking and sandbox primitives
Phase 41_system (System), 311 of 1047 in build order
Licence Apache-2.0
Homepage https://github.com/containers/netavark
Build time 2.6 SBU
Installed size 13.9 MiB in 4 files
Recipe ports/core/containers/netavark/kpkgbuild

About

netavark is podman’s network backend: when a container joins a podman network it creates the bridge and the veth pair, assigns the addresses, and writes the NAT and port-forwarding rules with the nftables firewall driver that containers-common’s containers.conf selects; it starts aardvark-dns for name resolution between containers. Podman runs it as a helper, so the port installs it at /usr/libexec/podman/netavark, a directory podman searches for its helper binaries, with its manual pages.

Sources

Dependencies

Depends on: rust, nftables, protobuf, go-md2man.

Required by (2): buildah, podman.

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 netavark'

What kpkg does

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

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/containers/netavark
echo '96677048168ddd1abe313e4c2e17f1cace72b60ee1bac8ca12a4bd7dfcadfbbb  netavark-2.1.0.tar.gz' | sha256sum -c -
echo 'ea3c9c3c5ee9589e928bd09fdb1c249ffc6bbae5a9fece5dae153f0f50e39e3a  netavark-vendor-2.1.0.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/netavark
SRC=$SRC_ROOT/netavark-2.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf netavark-2.1.0.tar.gz -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:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export LIBCLANG_PATH=/usr/lib
cargo build --release --frozen --offline
install -Dm755 target/release/netavark "$PKG/usr/libexec/podman/netavark"
make -C docs PREFIX=/usr DESTDIR=$PKG install

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/netavark, 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 netavark-2.1.0-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/netavark, and runs the triggers its paths call for.

Contents

Installed directories: /usr/share/licenses/netavark.

Notes

netavark is built from a vendor bundle, netavark-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor; see Vendoring. Its build script compiles src/proto/proxy.proto, the protocol of the DHCP proxy, with protoc, which is why protobuf is in depends; the manual pages are converted from Markdown with go-md2man by docs/Makefile. The nft program of nftables is what the firewall driver runs.

netavark writes its rules into a table of its own, inet netavark, beside the system firewall’s. The firewall’s ruleset replaces only its own inet filter table, so a reload leaves rootful containers’ address translation in place; see Adding your own rules.