EDNS_DEFAULT_BUFFER_SIZE=4096
# Load optional configuration
-[ -e "/etc/sysconfig/unbound" ] && . /etc/sysconfig/unbound
+#[ -e "/etc/sysconfig/unbound" ] && . /etc/sysconfig/unbound
function cidr() {
local cidr nbits IFS;
fi
}
+use_custom_forwarders() {
+ # Check if custom forwarders are presant via sysconfig and local.d
+ if grep -q "USE_FORWARDERS=0" /etc/sysconfig/unbound >/dev/null 2>&1; then
+ if grep -Rq "forward-zone:" /etc/unbound/local.d/* >/dev/null 2>&1; then
+ echo "Use Custom Forwarders in local.d"
+ write_tuning_conf
+ write_forward_conf
+ if ! pgrep unbound >/dev/null; then
+ boot_mesg "Starting Unbound DNS Proxy..."
+ loadproc /usr/sbin/unbound || exit $?
+ fi
+ #update_forwarders
+ unbound-control start >/dev/null
+ update_hosts
+ fix_time_if_dns_fail
+ unbound-control list_forwards
+ exit 0
+ fi
+ fi
+}
+
case "$1" in
start)
# Print a nicer messagen when unbound is already running
unbound-control-setup -d /etc/unbound &>/dev/null
fi
+ # Check if custom forwarders are presant
+ use_custom_forwarders
+
# Update configuration files
write_tuning_conf
write_forward_conf