isc-dhcp: adapt to new ipcalc paradigm
authorLeon M. Busch-George <leon@georgemail.eu>
Mon, 16 Oct 2023 03:33:15 +0000 (21:33 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Mon, 16 Oct 2023 03:33:15 +0000 (21:33 -0600)
With #12925, 'BROADCAST' will no longer be set if there is no local
broadcast address (rather than holding the global broadcast address).
Prepare for the merge but stay compatible with the old version of ipcalc.

Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
net/isc-dhcp/files/dhcpd.init

index 967ba83da25e22153c4fb22a21a19c6c54fa1393..0caffb8a81fa45ae343b963d6241a501841de6ec 100755 (executable)
@@ -374,7 +374,9 @@ gen_dhcp_subnet() {
                echo " range $START $END;"
        fi
        echo " option subnet-mask $netmask;"
-       if [ "$BROADCAST" != "0.0.0.0" ] ; then
+       # check for 0.0.0.0 until all active releases of ipcalc.sh omit it
+       # for small networks:
+       if [ -n "$BROADCAST" ] && [ "$BROADCAST" != "0.0.0.0" ] ; then
                echo " option broadcast-address $BROADCAST;"
        fi
        if [ "$dynamicdhcp" -eq 0 ] ; then
@@ -443,7 +445,7 @@ dhcpd_add() {
 
        dhcp_ifs="$dhcp_ifs $ifname"
 
-       eval "$(ipcalc.sh $subnet $start $limit)"
+       ipcalc $subnet $start $limit
 
        config_get netmask "$cfg" "netmask" "$NETMASK"
        config_get leasetime "$cfg" "leasetime"