isc-dhcp: refuse to add empty DHCP range 22414/head
authorLeon M. Busch-George <leon@georgemail.eu>
Mon, 16 Oct 2023 03:35:14 +0000 (21:35 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Mon, 16 Oct 2023 03:35:14 +0000 (21:35 -0600)
ipcalc.sh no longer outputs invalid ranges and fails with an error code in
such cases. React to the error.

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

index 0caffb8a81fa45ae343b963d6241a501841de6ec..111201009d033e3f88915b3cb37bc96bc1782162 100755 (executable)
@@ -445,7 +445,10 @@ dhcpd_add() {
 
        dhcp_ifs="$dhcp_ifs $ifname"
 
-       ipcalc $subnet $start $limit
+       if ! ipcalc "$subnet" "$start" "$limit"; then
+               echo "invalid range params: $subnet start: $start limit $limit" >&2
+               return 1
+       fi
 
        config_get netmask "$cfg" "netmask" "$NETMASK"
        config_get leasetime "$cfg" "leasetime"