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 <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville
2025-09-13 11:01:03 -06:00
parent 5116abcafa
commit 2a85ed0f1d
2 changed files with 17 additions and 4 deletions

View 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

View File

@@ -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