From: Philip Prindeville Date: Sat, 13 Sep 2025 17:01:03 +0000 (-0600) Subject: kea: add support synthesizing imported config files X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=2a85ed0f1db4d5be9681bf457d13e9ca72fa50a3;p=openwrt-packages.git kea: add support synthesizing imported config files 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 --- diff --git a/net/kea/Makefile b/net/kea/Makefile index 1f98e70f3..6689a632e 100644 --- a/net/kea/Makefile +++ b/net/kea/Makefile @@ -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 diff --git a/net/kea/files/kea.init b/net/kea/files/kea.init index a0b593c93..259861ae5 100755 --- a/net/kea/files/kea.init +++ b/net/kea/files/kea.init @@ -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