Clean-room implementation of Kea's Configuration Backend Commands hook. Builds
libdhcp_cb_cmds.so, implementing the public remote-* command surface
documented in the Kea ARM.
- Target API: Kea 3.0.0 Configuration Backend Commands documentation.
- Developed and tested against: Kea 3.0 and 3.1.
- Build modes: standalone Meson against installed Kea development packages
(
kea-develfrom RHEL 10 and compatible distributions, orisc-kea-develfrom ISC packages), or Kea source-tree overlay for full in-tree tests. - License: MPL-2.0.
This project is not affiliated with or endorsed by Internet Systems Consortium. Kea is a trademark of Internet Systems Consortium.
src/hooks/dhcp/cb_cmds/contains the hook source, load tests, unit tests, DB-backed tests, and API coverage script.meson.buildbuilds the hook against an installed Kea development package.packaging/rpm/contains the RPM spec forkea-hooks-cb-cmdsandisc-kea-hooks-cb-cmds.scripts/apply-overlay.shcopies the hook into a Kea source tree and wires the Kea Meson parent file.scripts/build-rpm-almalinux.shbuilds the RPM inside an AlmaLinux container using either distrokea-*packages or ISCisc-kea-*packages.scripts/run-tests.shruns the recommended non-DB test set from a configured Kea build directory.scripts/README.mddocuments local test and ARM conformance harness setup.
No Kea source tree is required. Two package families are supported:
- Distro (
kea-*, e.g.kea-devel): enable your distribution's Devel repo. - ISC (
isc-kea-*, e.g.isc-kea-devel): enable ISC's Cloudsmith Kea 3.0 LTS repo.
Install the matching Kea development package and the common build tools:
dnf install meson ninja-build gcc-c++ boost-devel log4cplus-devel openssl-devel libpq-devel mariadb-connector-c-devel
# Distro packages:
dnf install kea-devel
# ISC packages:
dnf install isc-kea-devel isc-kea-mysql isc-kea-pgsqlThen build the hook:
meson setup build-standalone -Dhooksdir=/usr/lib64/kea/hooks
meson compile -C build-standalone libdhcp_cb_cmds.so
meson install -C build-standaloneIf Kea is installed outside the platform's standard include or library paths, point Meson at those directories:
meson setup build-standalone \
-Dhooksdir=/usr/lib64/kea/hooks \
-Dkea_include_dir=/usr/include/kea \
-Dkea_lib_dir=/usr/lib64
meson compile -C build-standalone libdhcp_cb_cmds.soThe RPMs target RHEL 10 and compatible distributions. RPM builds use installed Kea development packages, not a full Kea checkout.
There are two package-source modes:
KEA_PACKAGE_SOURCE=distrobuilds against distrokea-*packages and produceskea-hooks-cb-cmds.KEA_PACKAGE_SOURCE=iscbuilds against ISCisc-kea-*packages and producesisc-kea-hooks-cb-cmds.
The helper builds in an AlmaLinux 10 container. Distro builds enable AlmaLinux's
CPU-specific Devel repo (where kea-devel lives): x86_64 by default, or the
x86_64_v2 repo when CPU_BASELINE=x86_64_v2.
# Default: ISC Kea 3.0 LTS packages in an AlmaLinux 10 container.
./scripts/build-rpm-almalinux.shOverride via environment variables:
KEA_PACKAGE_SOURCE—isc(default) ordistro.ISC_KEA_REPO— ISC repo to use, e.g.kea-3-0(default) orkea-dev.CPU_BASELINE—x86_64(default) orx86_64_v2.CONTAINER_ENGINE— e.g.podman.
The resulting RPMs are written below rpmbuild/RPMS/. The x86_64_v2 build
uses an RPM release suffix of .x86_64_v2 so both variants can be published
side by side.
From this repository:
./scripts/apply-overlay.sh /path/to/keaOverlay options (environment variables):
KEA_CB_CMDS_SKIP_DOCS=1— drop Kea'ssubdir('doc')before configuring.KEA_CB_CMDS_KEEP_SUDO=1— keep Kea's Meson-time sudo-test detection (disabled by default).
Then configure Kea with tests enabled:
cd /path/to/kea
meson setup build -Dtests=enabled
meson compile -C build libdhcp_cb_cmds.so
meson test -C build \
dhcp-cb-cmds-tests \
dhcp-cb-cmds-libload-tests \
dhcp-cb-cmds-api-coverage \
kea-config-backend-tests \
--print-errorlogsFor MySQL/PostgreSQL-backed integration coverage, configure Kea with DB support and run:
KEA_CB_CMDS_DB_TESTS=1 KEA_TEST_DB_WIPE_DATA_ONLY=false \
meson test -C build-db dhcp-cb-cmds-db-tests --print-errorlogsThe DB test suite expects reachable Kea test databases using Kea's existing DB test infrastructure.
For local leak/undefined-behavior checks, configure a sanitizer build and run the cb_cmds C++ tests through the helper:
meson setup build-asan \
-Dtests=enabled \
-Dcpp_std=c++17 \
-Db_sanitize=address,undefined
./scripts/run-tests.sh --leak-check build-asan--leak-check sets ASAN_OPTIONS, LSAN_OPTIONS, and UBSAN_OPTIONS so any
finding fails the run, and scopes it to the cb_cmds test binaries (not the full
Kea suite). macOS lacks LeakSanitizer support, so use a Linux build for real
leak checks.
CI uploads sanitizer command output and Meson logs as the sanitizer-results
artifact.
Useful dependencies for a local Kea test build:
brew install meson ninja log4cplus googletest bison mysql-client libpq
export PATH="/opt/homebrew/opt/mysql-client/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/opt/bison/bin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig:/opt/homebrew/opt/libpq/lib/pkgconfig:$PKG_CONFIG_PATH"Clean local run of scripts/arm_conformance.py passes against both MySQL and
PostgreSQL config backends:
Set KEA_CB_CMDS_ARM_CONFORMANCE_RUN_DIR=/path/to/results to preserve daemon
logs, generated configs, PID files, lock files, and lease files. CI uploads
these files plus the conformance transcript as arm-conformance-results-postgresql
and arm-conformance-results-mysql artifacts.
=== DHCPv4 ===
PASS server-set result=0 server set
PASS server-get [ARM servers-list form] result=0 server returned
PASS server-get-all result=0 servers returned
PASS subnet-set [id+relay] result=0 subnet set
PASS subnet-get-by-id result=0 subnet returned
PASS subnet-get-by-prefix result=0 subnet returned
PASS subnet-list result=0 subnets returned
PASS global-parameter-set result=0 global parameters set
PASS global-parameter-get result=0 global parameter returned
PASS global-parameter-get-all result=0 global parameters returned
PASS network-set result=0 shared network set
PASS network-get result=0 shared network returned
PASS network-list result=0 shared networks returned
PASS option-def-set [ARM: no array/record-types/encapsulate] result=0 option definition set
PASS option-def-get result=0 option definition returned
PASS option-def-get-all result=0 option definitions returned
PASS option-global-set result=0 option set
PASS option-global-get result=0 option returned
PASS option-global-get-all result=0 options returned
PASS option-subnet-set result=0 option set
PASS option-pool-set result=0 option set
PASS option-network-set result=0 option set
PASS daemon serves CB subnet served=True
PASS server-del [ARM servers-list form] result=0 server deleted
=== DHCPv6 ===
PASS server-set result=0 server set
PASS server-get [ARM servers-list form] result=0 server returned
PASS server-get-all result=0 servers returned
PASS subnet-set [id+relay] result=0 subnet set
PASS subnet-get-by-id result=0 subnet returned
PASS subnet-get-by-prefix result=0 subnet returned
PASS subnet-list result=0 subnets returned
PASS global-parameter-set result=0 global parameters set
PASS global-parameter-get result=0 global parameter returned
PASS global-parameter-get-all result=0 global parameters returned
PASS network-set result=0 shared network set
PASS network-get result=0 shared network returned
PASS network-list result=0 shared networks returned
PASS option-def-set [ARM: no array/record-types/encapsulate] result=0 option definition set
PASS option-def-get result=0 option definition returned
PASS option-def-get-all result=0 option definitions returned
PASS option-global-set result=0 option set
PASS option-global-get result=0 option returned
PASS option-global-get-all result=0 options returned
PASS option-subnet-set result=0 option set
PASS option-pool-set result=0 option set
PASS option-network-set result=0 option set
PASS option-pd-pool-set result=0 option set
PASS daemon serves CB subnet served=True
PASS server-del [ARM servers-list form] result=0 server deleted
=== SUMMARY ===
checks: 49 passed: 49 DEVIATIONS: 0