From f9be61715fe30b5ee55b98fba7495fd678eb564a Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Sat, 17 Jun 2023 20:09:48 -0600 Subject: [PATCH] isc-dhcp: force sending unrequested parameters Signed-off-by: Philip Prindeville --- net/isc-dhcp/Makefile | 2 +- net/isc-dhcp/files/dhcpd.init | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile index b326d48a0..981063dae 100644 --- a/net/isc-dhcp/Makefile +++ b/net/isc-dhcp/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=isc-dhcp UPSTREAM_NAME:=dhcp PKG_VERSION:=4.4.3-P1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE diff --git a/net/isc-dhcp/files/dhcpd.init b/net/isc-dhcp/files/dhcpd.init index 7eb3dc3af..8aa30cd27 100755 --- a/net/isc-dhcp/files/dhcpd.init +++ b/net/isc-dhcp/files/dhcpd.init @@ -274,6 +274,7 @@ static_srvhosts() { static_host_add() { local cfg="$1" local broadcast hostid macn macs mac name ip ips revip leasetime + local force_send extra_options option config_get macs "$cfg" "mac" [ -n "$macs" ] || return 0 @@ -296,6 +297,23 @@ static_host_add() { hex_to_hostid hostid "$hostid" || return 1 fi + config_get force_send "$cfg" "force_send" + extra_options= + local _IFS="$IFS" IFS=',' + for option in $force_send; do + case "$option" in + hostname) + extra_options="$extra_options${extra_options:+ }0c" ;; + domain-name) + extra_options="$extra_options${extra_options:+ }0f" ;; + fqdn) + extra_options="$extra_options${extra_options:+ }51" ;; + *) + echo "unknown option: $option" >&2 ;; + esac + done + IFS="$_IFS" + macn=0 for mac in $macs; do macn=$(( macn + 1 )) @@ -328,6 +346,9 @@ static_host_add() { fi config_list_foreach "$cfg" "routes" append_routes config_list_foreach "$cfg" "dhcp_option" append_dhcp_options + if [ -n "$extra_options" ]; then + echo -e " if exists dhcp-parameter-request-list {\n option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list, $extra_options);\n }" + fi echo "}" done