Bug 238753

Summary: /etc/rc.d/local_unbound fails to honor configuration directory setting post-start
Product: Base System Reporter: karl
Component: confAssignee: freebsd-rc (Nobody) <rc>
Status: New ---    
Severity: Affects Some People Keywords: patch
Priority: ---    
Version: 12.0-STABLE   
Hardware: Any   
OS: Any   
Description Flags
Address missing "-c" flag on the control command none

Description karl 2019-06-21 19:52:39 UTC
Created attachment 205269 [details]
Address missing "-c" flag on the control command

/etc/rc.d/local_unbound starts the local "unbound" nameserver.

The script assumes the working directory is in /var/unbound, which is valid for most users.  However, in an embedded environment /var is frequently on a ramdisk and not saved (that is, it's volatile), which means you need to move this directory for those environments since otherwise you will be regenerating the configuration on each boot -- and that is probably not desirable.

The base RC script is intended to honor local_unbound_workdir in /etc/rc.conf, but the "local_unbound_poststart()" function makes a call to the "-control" software without specifying the config directory explicitly with "-c".  If the working directory is not in the default location this results in that command failing; this is not fatal since the test gives up after five tries, but it should honor the config directive and thus know when the startup has completed successfully.

The attached patch adds the "-c" flag to the control command and resolves the issue.