From a050b08db2edf2290d28a3834065cf6c4aa127dd Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 10 Dec 2025 15:03:41 -0700 Subject: [PATCH] isc-dhcp: fix startup issues with RFC-1918 PTR RRs If isc-dhcp gets restarted, it might have to deal with RFC-1918 zones being previously populated by an earlier instance. In that case, we need to know if we're modified versus initially adding the zones. The special handling of RFC-1918 zones in Bind is quirky, and there should be a patch soon to make it more friendly, but in the meantime you might have to use: disable-empty-zone 168.192.in-addr.arpa; Or similar depending on which address block you poach. Signed-off-by: Philip Prindeville --- net/isc-dhcp/Makefile | 2 +- net/isc-dhcp/files/dhcpd.init | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/net/isc-dhcp/Makefile b/net/isc-dhcp/Makefile index c9eddf3a3e..86de3d67e2 100644 --- a/net/isc-dhcp/Makefile +++ b/net/isc-dhcp/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=isc-dhcp UPSTREAM_NAME:=dhcp PKG_REALVERSION:=4.4.3-P1 PKG_VERSION:=4.4.3_p1 -PKG_RELEASE:=13 +PKG_RELEASE:=14 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 d7f24d9be0..6e1cb53f72 100755 --- a/net/isc-dhcp/files/dhcpd.init +++ b/net/isc-dhcp/files/dhcpd.init @@ -154,7 +154,7 @@ EOF } create_empty_zone() { - local zone error zpath + local zone error zpath command zone="$1" zpath="$dyndir/db.$zone" @@ -167,7 +167,15 @@ create_empty_zone() { chown bind:bind "$zpath" || return 1 chmod 0664 "$zpath" || return 1 - if ! error=$(rndc modzone $zone "{ + # if the zone doesn't exist, we need to add it, otherwise we need to + # create it. + if ! rndc zonestatus $zone >/dev/null 2>&1; then + command="addzone" + else + command="modzone" + fi + + if ! error=$(rndc $command $zone "{ type primary; file \"$zpath\"; update-policy {