Fix:
        The following diff fixes /etc/rc.d/unbound by:
        Sets _config to the configuration file used in $daemon_flags.
        Pass $_config to unbound-checkconf (two lines).
        Pass $_anchor to unbound-anchor.

Breakup the long _config= line so it is more readable.


--- /etc/rc.d/unbound   Wed Oct  9 11:42:56 2024
+++ /etc/rc.d/unbound   Thu Nov 13 10:49:17 2025
@@ -1,20 +1,29 @@
 #!/bin/ksh
 #
 # $OpenBSD: unbound,v 1.9 2024/10/09 15:42:56 kn Exp $
 
 daemon="/usr/sbin/unbound"
 daemon_flags="-c /var/unbound/etc/unbound.conf"
 
 . /etc/rc.d/rc.subr
 
 rc_pre() {
+       local _config=
+
+       while getopts :c: _opt $daemon_flags
+       do
+               case $_opt in
+               c)      _config=$OPTARG ;;
+               esac
+       done
+
-       local _anchor=$(/usr/sbin/unbound-checkconf -o auto-trust-anchor-file)
+       local _anchor=$(/usr/sbin/unbound-checkconf -o auto-trust-anchor-file 
$_config)

        if [[ -n $_anchor && ! -f $_anchor ]]; then
-               /usr/sbin/unbound-anchor -v
+               /usr/sbin/unbound-anchor -v -a $_anchor
        fi
 
-       /usr/sbin/unbound-checkconf
+       /usr/sbin/unbound-checkconf $_config
 }
 
 rc_cmd $1

Reply via email to