Base LEDE/OpenWrt UCI for dnsmasq provides for DNS override in /etc/config/dhcp. It is desired to be able to use dnsmasq and Unbound as transparently as possible. Option 'add_extra_dns' will pull 'domain', 'mxhost', 'srvhost, and 'cname' from base. netifd/procd have an interaction with DHCPv6/RA on WAN (FS#713). Minor IP6 parameter updates can cause Unbound reload events every few minutes. List option 'trigger' selects which interfaces may cause reload. For example 'lan', 'wan' but not 'wan6'. Squash other cosmetics. Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
75 lines
1.9 KiB
Bash
Executable file
75 lines
1.9 KiB
Bash
Executable file
#!/bin/sh /etc/rc.common
|
|
##############################################################################
|
|
#
|
|
# Copyright (C) 2016 Michael Hanselmann, Eric Luehrsen
|
|
#
|
|
##############################################################################
|
|
#
|
|
# This init script is just the entry point for Unbound UCI.
|
|
#
|
|
##############################################################################
|
|
|
|
START=19
|
|
STOP=50
|
|
USE_PROCD=1
|
|
PROG=/usr/sbin/unbound
|
|
|
|
##############################################################################
|
|
|
|
. /usr/lib/unbound/unbound.sh
|
|
|
|
##############################################################################
|
|
|
|
boot() {
|
|
UNBOUND_BOOT=1
|
|
start "$@"
|
|
}
|
|
|
|
##############################################################################
|
|
|
|
start_service() {
|
|
if [ -n "$UNBOUND_BOOT" ] ; then
|
|
# Load procd triggers (rc) and use event IFUP to really start
|
|
return 0
|
|
fi
|
|
|
|
# complex UCI work
|
|
unbound_start
|
|
|
|
# standard procd clause
|
|
procd_open_instance
|
|
procd_set_param command $PROG -d -c $UNBOUND_CONFFILE
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|
|
|
|
##############################################################################
|
|
|
|
stop_service() {
|
|
unbound_stop
|
|
|
|
# Wait! on restart Unbound may take time writing closure stats to syslog
|
|
pidof $PROG && sleep 1
|
|
}
|
|
|
|
##############################################################################
|
|
|
|
service_triggers() {
|
|
local trigger
|
|
local triggers=$( uci_get unbound.@unbound[0].trigger )
|
|
|
|
PROCD_RELOAD_DELAY=2000
|
|
procd_add_reload_trigger "unbound"
|
|
|
|
if [ -n "$triggers" ] ; then
|
|
for trigger in $triggers ; do
|
|
# due to some netifd/procd interactions with IP6, limit interfaces
|
|
procd_add_reload_interface_trigger "$trigger"
|
|
done
|
|
else
|
|
procd_add_raw_trigger "interface.*.up" 2000 /etc/init.d/unbound reload
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
|