isc-dhcpd: don't invoke ipcalc with empty start/range arguments
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sun, 14 Jul 2024 20:17:50 +0000 (14:17 -0600)
committerPhilip Prindeville <philipp@redfish-solutions.com>
Mon, 15 Jul 2024 16:05:17 +0000 (10:05 -0600)
Handle not having a dynamic pool correctly without ipcalc.sh
generating noise about it.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
net/isc-dhcp/Makefile
net/isc-dhcp/files/dhcpd.init

index 81fd97681b2de56064358365ed94b75a5b057c70..87a6416b75356695e9dbd51762bdc74819df9b21 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:=7
+PKG_RELEASE:=8
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
index 927924dbc69ac2cc0d06f0febefa045654fdd518..5723957696d759396d86dbfba4dc6680e59b186b 100755 (executable)
@@ -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