kea: add support synthesizing imported config files
authorPhilip Prindeville <redacted>
Sat, 13 Sep 2025 17:01:03 +0000 (11:01 -0600)
committerPhilip Prindeville <redacted>
Thu, 9 Apr 2026 23:36:46 +0000 (17:36 -0600)
Configuring Kea JSON files is not trivial, and this might impede
the adoption of Kea as a DHCP server.  There are, however, many
users who used its predecessor ISC-DHCP, at least for DHCPv4.
A filter could ingest the legacy UCI and synthesize a JSON config
file for Kea DHCPv4.

Signed-off-by: Philip Prindeville <redacted>
net/kea/Makefile
net/kea/files/kea.init

index 1f98e70f30c46c93fbf645985870e46a69e7ebd9..6689a632ed8c6251a81d7afbf9617082a48bd088 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=kea
 PKG_VERSION:=3.0.2
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://ftp.isc.org/isc/kea/$(PKG_VERSION)
@@ -260,6 +260,8 @@ define Package/kea-uci/install
        $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
        $(INSTALL_CONF) ./files/kea.config $(1)/etc/config/kea
        $(INSTALL_BIN) ./files/kea.init $(1)/etc/init.d/kea
+       $(INSTALL_DIR) $(1)/usr/lib/kea/importers
+       $(INSTALL_BIN) ./files/dhcp4.sh $(1)/usr/lib/kea/importers/
 endef
 
 define Package/kea-uci/conffiles
index a0b593c93bbff0e843517a4ab778a053e3876830..259861ae5fe34ace67a65ced17318ba4d3c70cf3 100755 (executable)
@@ -4,6 +4,7 @@ USE_PROCD=1
 START=25
 STOP=85
 
+LIB_PATH="/usr/lib/kea"
 BIN_PATH="/usr/sbin"
 CONF_PATH="/etc/kea"
 
@@ -16,6 +17,7 @@ start_service() {
 
 start_kea() {
        local cfg="$1"
+       local name cmd cnf importer
 
        config_get_bool disabled "$cfg" disabled 0
        [ "$disabled" = "0" ] || return
@@ -24,9 +26,6 @@ start_kea() {
 
        case "$name" in
                ctrl_agent|dhcp4|dhcp6|dhcp_ddns)
-                       name="${name/_/-}"
-                       cmd="${BIN_PATH}/kea-${name}"
-                       cnf="${CONF_PATH}/kea-${name}.conf"
                        ;;
                *)
                        echo "Error: Invalid service name '$name'" >&2
@@ -34,6 +33,18 @@ start_kea() {
                        ;;
        esac
 
+       name="${name/_/-}"
+       cmd="${BIN_PATH}/kea-${name}"
+       cnf="${CONF_PATH}/kea-${name}.conf"
+       importer="${LIB_PATH}/importers/${name}.sh"
+
+       if [ -f "$importer" ]; then
+               if ! "$importer" "$cnf"; then
+                       echo "Error: Importer '$importer' failed; aborting." >&2
+                       return 1
+               fi
+       fi
+
        procd_open_instance "$name"
        procd_set_param command "$cmd" -c "$cnf"
        procd_set_param env KEA_LOCKFILE_DIR=/tmp
git clone https://git.99rst.org/PROJECT