isc-dhcpd: don't invoke ipcalc with empty start/range arguments

Handle not having a dynamic pool correctly without ipcalc.sh
generating noise about it.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
This commit is contained in:
Philip Prindeville
2024-07-14 14:17:50 -06:00
parent fa64b3a614
commit cb543e5b93
2 changed files with 8 additions and 3 deletions

View File

@@ -465,8 +465,13 @@ dhcpd_add() {
append dhcp_ifs "$ifname"
if ! ipcalc "$subnet" "$start" "$limit"; then
echo "invalid range params: $subnet start: $start limit $limit" >&2
if [ -z "$start$limit" ]; then
if ! ipcalc "$subnet"; then
echo "invalid subnet param: $start" >&2
return 1
fi
elif ! ipcalc "$subnet" "$start" "$limit"; then
echo "invalid range params: $subnet start: $start limit: $limit" >&2
return 1
fi