From: Philip Prindeville <philipp@redfish-solutions.com>
Date: Sun, 14 Jul 2024 20:17:50 +0000 (-0600)
Subject: isc-dhcpd: don't invoke ipcalc with empty start/range arguments
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=cb543e5b93cf183343db8325d04ad16468dc85ba;p=feed%2Fpackages.git

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

diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile
index 81fd97681b..87a6416b75 100644
--- a/net/isc-dhcp/Makefile
+++ b/net/isc-dhcp/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=isc-dhcp
 UPSTREAM_NAME:=dhcp
 PKG_VERSION:=4.4.3-P1
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
diff --git a/net/isc-dhcp/files/dhcpd.init b/net/isc-dhcp/files/dhcpd.init
index 927924dbc6..5723957696 100755
--- a/net/isc-dhcp/files/dhcpd.init
+++ b/net/isc-dhcp/files/dhcpd.init
@@ -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