isc-dhcp: force sending unrequested parameters 21402/head
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sun, 18 Jun 2023 02:09:48 +0000 (20:09 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Tue, 20 Jun 2023 01:27:49 +0000 (19:27 -0600)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
net/isc-dhcp/Makefile
net/isc-dhcp/files/dhcpd.init

index b326d48a0f03025abce5fa568a262b455723be97..981063dae5ef8a73fdad8490982980a86cac4734 100644 (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
index 7eb3dc3af762dc8cf3206cea816010e07499e629..8aa30cd27dd77b777befca5890cec6f8f9f0a02c 100755 (executable)
@@ -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