>Synopsis:      /etc/rc.d/unbound assumes defaults in rc_pre()
>Category:      system
>Environment:
        System      : OpenBSD 7.8
        Details     : OpenBSD 7.8 (GENERIC.MP) #54: Sun Oct 12 12:58:11 MDT 2025
                         
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        The commands used in rc_pre() assume default config file for unbound.
        The unbound-checkconf lines in rc_pre will always use default config,
        ignoring the config file specified in daemon_flags.
        The unbound-anchor line also assumes default and does not provide
        the $_anchor that was already just looked up (from default config file).
        Why two unbounds?  One for query forwarding and one for recursive 
resolution.
>How-To-Repeat:
        Follow "man rcctl" recommended way to run second copy of daemon
        by creating symbolic link unbound2 (ln -s unbound unbound2) and
        and adding "unbound2_flags=-c /var/unbound/etc/unbound2.conf"
        to rc.conf.local (and adding unbound2 to pkg_scripts=).
        Also create /etc/login.conf.d/unbound2 with "unbound2:tc=unbound:".
        And of course use different "interface:, control-interface:, 
auto-trust-anchor-file:"
        lines in the unbound configuration files to avoid conflicts.
>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.

--- /etc/rc.d/unbound   Wed Oct  9 11:42:56 2024
+++ /etc/rc.d/unbound   Sun Oct 12 14:32:22 2025
@@ -1,20 +1,21 @@
 #!/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 { 
(c) echo $OPTARG; } 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


dmesg:
OpenBSD 7.8 (GENERIC.MP) #54: Sun Oct 12 12:58:11 MDT 2025
    [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 103052140544 (98278MB)
avail mem = 99901595648 (95273MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdf7fe000 (127 entries)
bios0: vendor HP version "P68" date 05/21/2018
bios0: HP ProLiant DL360 G7
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP SPCR MCFG HPET FFFF SPMI ERST APIC SRAT FFFF BERT HEST 
DMAR SSDT SSDT SSDT SSDT SSDT
acpi0: wakeup devices
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimcfg0 at acpi0
acpimcfg0: addr 0xe0000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.78 MHz, 06-2c-02, patch 
0000001f
cpu0: cpuid 1 
edx=bfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
 
ecx=29ee3ff<SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,POPCNT,AES>
cpu0: cpuid 6 eax=5<SENSOR,ARAT> ecx=9<EFFFREQ>
cpu0: cpuid 7.0 edx=9c000000<IBRS,IBPB,STIBP,L1DF,SSBD>
cpu0: cpuid a vers=3, gp=4, gpwidth=48, ff=3, ffwidth=48
cpu0: cpuid 80000001 edx=2c100800<NXE,PAGE1GB,RDTSCP,LONG> ecx=1<LAHF>
cpu0: cpuid 80000007 edx=100<ITSC>
cpu0: MELTDOWN
cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 4-way I-cache, 256KB 64b/line 
8-way L2 cache, 12MB 64b/line 16-way L3 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 133MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE
cpu1 at mainbus0: apid 32 (application processor)
cpu1: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.78 MHz, 06-2c-02, patch 
0000001f
cpu1: smt 0, core 0, package 1
cpu2 at mainbus0: apid 16 (application processor)
cpu2: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.77 MHz, 06-2c-02, patch 
0000001f
cpu2: smt 0, core 8, package 0
cpu3 at mainbus0: apid 48 (application processor)
cpu3: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.77 MHz, 06-2c-02, patch 
0000001f
cpu3: smt 0, core 8, package 1
cpu4 at mainbus0: apid 4 (application processor)
cpu4: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.81 MHz, 06-2c-02, patch 
0000001f
cpu4: smt 0, core 2, package 0
cpu5 at mainbus0: apid 36 (application processor)
cpu5: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.84 MHz, 06-2c-02, patch 
0000001f
cpu5: smt 0, core 2, package 1
cpu6 at mainbus0: apid 20 (application processor)
cpu6: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.84 MHz, 06-2c-02, patch 
0000001f
cpu6: smt 0, core 10, package 0
cpu7 at mainbus0: apid 52 (application processor)
cpu7: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.82 MHz, 06-2c-02, patch 
0000001f
cpu7: smt 0, core 10, package 1
cpu8 at mainbus0: apid 2 (application processor)
cpu8: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.82 MHz, 06-2c-02, patch 
0000001f
cpu8: smt 0, core 1, package 0
cpu9 at mainbus0: apid 34 (application processor)
cpu9: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.90 MHz, 06-2c-02, patch 
0000001f
cpu9: smt 0, core 1, package 1
cpu10 at mainbus0: apid 18 (application processor)
cpu10: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.98 MHz, 06-2c-02, patch 
0000001f
cpu10: smt 0, core 9, package 0
cpu11 at mainbus0: apid 50 (application processor)
cpu11: Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 2266.81 MHz, 06-2c-02, patch 
0000001f
cpu11: smt 0, core 9, package 1
ioapic0 at mainbus0: apid 8 pa 0xfec00000, version 20, 24 pins
ioapic1 at mainbus0: apid 0 pa 0xfec80000, version 20, 24 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (IP2P)
acpiprt2 at acpi0: bus 17 (IPT1)
acpiprt3 at acpi0: bus -1 (IPT3)
acpiprt4 at acpi0: bus 2 (IPT5)
acpiprt5 at acpi0: bus 5 (PT01)
acpiprt6 at acpi0: bus 9 (PT03)
acpiprt7 at acpi0: bus 13 (PT04)
acpiprt8 at acpi0: bus 14 (PT05)
acpiprt9 at acpi0: bus 15 (PT06)
acpiprt10 at acpi0: bus 3 (PT07)
acpiprt11 at acpi0: bus 4 (PT08)
acpiprt12 at acpi0: bus 6 (PT09)
acpiprt13 at acpi0: bus 16 (PT0A)
acpipci0 at acpi0 PCI0
ipmi0 at acpi0: version 2.0 interface KCS iobase 0xca2/2 spacing 1
"PNP0303" at acpi0 not configured
"PNP0F13" at acpi0 not configured
"PNP0A06" at acpi0 not configured
com1 at acpi0 COMA addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo
acpicmos0 at acpi0
"ACPI000D" at acpi0 not configured
acpicpu0 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu1 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu2 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu3 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu4 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu5 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu6 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu7 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu8 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu9 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu10 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpicpu11 at acpi0: C3(350@96 mwait.1@0x20), C3(500@64 mwait.1@0x10), C1(1000@1 
mwait.1)
acpitz0 at acpi0
acpitz0: critical temperature is 31 degC
ipmi at mainbus0 not configured
cpu0: using IvyBridge MDS workaround
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 5520 Host" rev 0x13
ppb0 at pci0 dev 1 function 0 "Intel X58 PCIE" rev 0x13
pci1 at ppb0 bus 5
ciss0 at pci1 dev 0 function 0 "Hewlett-Packard Smart Array" rev 0x01: apic 0 
int 4
ciss0: 1 LD, HW rev 2, FW 6.64/6.63, 64bit fifo rro
scsibus1 at ciss0: 1 targets
sd0 at scsibus1 targ 0 lun 0: <HP, LOGICAL VOLUME, 6.64>
sd0: 279964MB, 512 bytes/sector, 573367600 sectors
ppb1 at pci0 dev 2 function 0 "Intel X58 PCIE" rev 0x13
pci2 at ppb1 bus 12
ppb2 at pci0 dev 3 function 0 "Intel X58 PCIE" rev 0x13
pci3 at ppb2 bus 9
ppb3 at pci0 dev 4 function 0 "Intel X58 PCIE" rev 0x13
pci4 at ppb3 bus 13
ppb4 at pci0 dev 5 function 0 "Intel X58 PCIE" rev 0x13
pci5 at ppb4 bus 14
ppb5 at pci0 dev 6 function 0 "Intel X58 PCIE" rev 0x13
pci6 at ppb5 bus 15
ppb6 at pci0 dev 7 function 0 "Intel X58 PCIE" rev 0x13
pci7 at ppb6 bus 3
bnx0 at pci7 dev 0 function 0 "Broadcom BCM5709" rev 0x20: apic 0 int 6
bnx1 at pci7 dev 0 function 1 "Broadcom BCM5709" rev 0x20: apic 0 int 13
ppb7 at pci0 dev 8 function 0 "Intel X58 PCIE" rev 0x13
pci8 at ppb7 bus 4
bnx2 at pci8 dev 0 function 0 "Broadcom BCM5709" rev 0x20: apic 0 int 7
bnx3 at pci8 dev 0 function 1 "Broadcom BCM5709" rev 0x20: apic 0 int 15
ppb8 at pci0 dev 9 function 0 "Intel X58 PCIE" rev 0x13
pci9 at ppb8 bus 6
xhci0 at pci9 dev 0 function 0 "ASMedia ASM1042AE xHCI" rev 0x00: msix, xHCI 
1.10
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "ASMedia xHCI root hub" rev 3.00/1.00 
addr 1
ppb9 at pci0 dev 10 function 0 "Intel X58 PCIE" rev 0x13
pci10 at ppb9 bus 16
pchb1 at pci0 dev 13 function 0 vendor "Intel", unknown product 0x343a rev 0x13
pchb2 at pci0 dev 13 function 1 vendor "Intel", unknown product 0x343b rev 0x13
pchb3 at pci0 dev 13 function 2 vendor "Intel", unknown product 0x343c rev 0x13
pchb4 at pci0 dev 13 function 3 vendor "Intel", unknown product 0x343d rev 0x13
pchb5 at pci0 dev 13 function 4 "Intel 5520/X58 QuickPath" rev 0x13
pchb6 at pci0 dev 13 function 5 "Intel 5520 QuickPath" rev 0x13
pchb7 at pci0 dev 13 function 6 vendor "Intel", unknown product 0x341a rev 0x13
pchb8 at pci0 dev 14 function 0 vendor "Intel", unknown product 0x341c rev 0x13
pchb9 at pci0 dev 14 function 1 vendor "Intel", unknown product 0x341d rev 0x13
pchb10 at pci0 dev 14 function 2 vendor "Intel", unknown product 0x341e rev 0x13
pchb11 at pci0 dev 14 function 3 vendor "Intel", unknown product 0x341f rev 0x13
pchb12 at pci0 dev 14 function 4 vendor "Intel", unknown product 0x3439 rev 0x13
"Intel X58 Misc" rev 0x13 at pci0 dev 20 function 0 not configured
"Intel X58 GPIO" rev 0x13 at pci0 dev 20 function 1 not configured
"Intel X58 RAS" rev 0x13 at pci0 dev 20 function 2 not configured
ppb10 at pci0 dev 28 function 0 "Intel 82801JI PCIE" rev 0x00
pci11 at ppb10 bus 17
ppb11 at pci0 dev 28 function 4 "Intel 82801JI PCIE" rev 0x00
pci12 at ppb11 bus 2
"Hewlett-Packard iLO3 Slave" rev 0x04 at pci12 dev 0 function 0 not configured
"Hewlett-Packard iLO3 Management" rev 0x04 at pci12 dev 0 function 2 not 
configured
uhci0 at pci12 dev 0 function 4 "Hewlett-Packard USB" rev 0x01: apic 8 int 17
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "Hewlett-Packard UHCI root hub" rev 
1.00/1.00 addr 1
uhci1 at pci0 dev 29 function 0 "Intel 82801JI USB" rev 0x00: apic 8 int 20
uhci2 at pci0 dev 29 function 1 "Intel 82801JI USB" rev 0x00: apic 8 int 23
uhci3 at pci0 dev 29 function 2 "Intel 82801JI USB" rev 0x00: apic 8 int 22
uhci4 at pci0 dev 29 function 3 "Intel 82801JI USB" rev 0x00: apic 8 int 23
ehci0 at pci0 dev 29 function 7 "Intel 82801JI USB" rev 0x00: apic 8 int 20
usb2 at ehci0: USB revision 2.0
uhub2 at usb2 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 
addr 1
ppb12 at pci0 dev 30 function 0 "Intel 82801BA Hub-to-PCI" rev 0x90
pci13 at ppb12 bus 1
vga1 at pci13 dev 3 function 0 "ATI ES1000" rev 0x02
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 31 function 0 "Intel 82801JIB LPC" rev 0x00
pciide0 at pci0 dev 31 function 2 "Intel 82801JI SATA" rev 0x00: DMA, channel 0 
configured to native-PCI, channel 1 configured to native-PCI
pciide0: using apic 8 int 17 for native-PCI interrupt
atapiscsi0 at pciide0 channel 0 drive 0
scsibus2 at atapiscsi0: 2 targets
cd0 at scsibus2 targ 0 lun 0: <hp, DVD D DS8D3SH, HHE7> removable
cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
usb3 at uhci1: USB revision 1.0
uhub3 at usb3 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb4 at uhci2: USB revision 1.0
uhub4 at usb4 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb5 at uhci3: USB revision 1.0
uhub5 at usb5 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb6 at uhci4: USB revision 1.0
uhub6 at usb6 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: probed fifo depth: 0 bytes
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
vmm0 at mainbus0: VMX/EPT
uhub7 at uhub0 port 2 configuration 1 interface 0 "VIA Labs, Inc. USB3.0 Hub" 
rev 3.00/91.05 addr 2
uhub8 at uhub0 port 4 configuration 1 interface 0 "VIA Labs, Inc. USB2.0 Hub" 
rev 2.10/91.00 addr 3
umodem0 at uhub6 port 1 configuration 1 interface 0 "u-blox AG - www.u-blox.com 
u-blox 7 - GPS/GNSS Receiver" rev 1.10/1.00 addr 2
umodem0: data interface 1, has CM over data, has no break
umodem0: status change notification available
ucom0 at umodem0: usb6.0.00001.1
vscsi0 at root
scsibus3 at vscsi0: 256 targets
softraid0 at root
scsibus4 at softraid0: 256 targets
root on sd0a (5ef582e9d02f7a4e.a) swap on sd0b dump on sd0b
bnx0: address 9c:8e:99:2d:55:8c
brgphy0 at bnx0 phy 1: BCM5709, rev. 8
bnx1: address 9c:8e:99:2d:55:8e
brgphy1 at bnx1 phy 1: BCM5709, rev. 8
bnx2: address 9c:8e:99:2d:55:88
brgphy2 at bnx2 phy 1: BCM5709, rev. 8
bnx3: address 9c:8e:99:2d:55:8a
brgphy3 at bnx3 phy 1: BCM5709, rev. 8
uhidev0 at uhub1 port 1 configuration 1 interface 0 "HP Virtual Keyboard" rev 
1.10/0.02 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes, country code 33
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub1 port 1 configuration 1 interface 1 "HP Virtual Keyboard" rev 
1.10/0.02 addr 2
uhidev1: iclass 3/1
ums0 at uhidev1: 3 buttons
wsmouse0 at ums0 mux 0
ipmi0: watchdog enabled

usbdevs:
Controller /dev/usb0:
addr 01: 1b21:0000 ASMedia, xHCI root hub
         super speed, self powered, config 1, rev 1.00
         driver: uhub0
addr 02: 2109:0812 VIA Labs, Inc., USB3.0 Hub
         super speed, self powered, config 1, rev 91.05
         driver: uhub7
addr 03: 2109:2812 VIA Labs, Inc., USB2.0 Hub
         high speed, self powered, config 1, rev 91.00
         driver: uhub8
Controller /dev/usb1:
addr 01: 103c:0000 Hewlett-Packard, UHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub1
addr 02: 03f0:7029 HP, Virtual Keyboard
         full speed, self powered, config 1, rev 0.02
         driver: uhidev0
         driver: uhidev1
Controller /dev/usb2:
addr 01: 8086:0000 Intel, EHCI root hub
         high speed, self powered, config 1, rev 1.00
         driver: uhub2
Controller /dev/usb3:
addr 01: 8086:0000 Intel, UHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub3
Controller /dev/usb4:
addr 01: 8086:0000 Intel, UHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub4
Controller /dev/usb5:
addr 01: 8086:0000 Intel, UHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub5
Controller /dev/usb6:
addr 01: 8086:0000 Intel, UHCI root hub
         full speed, self powered, config 1, rev 1.00
         driver: uhub6
addr 02: 1546:01a7 u-blox AG - www.u-blox.com, u-blox 7 - GPS/GNSS Receiver
         full speed, self powered, config 1, rev 1.00
         driver: umodem0

Reply via email to