isc-dhcp: force sending unrequested parameters

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville 2023-06-17 20:09:48 -06:00
parent 0e652e2449
commit f9be61715f
2 changed files with 22 additions and 1 deletions

View file

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

View file

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