From 0d79daca0d90d702fcda50b756fed00491b4e728 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Tue, 7 Dec 2010 23:10:56 +0200 Subject: Add unbound_validation() to ensure that DNSMasq is not enabled, if so dont disable it but inform the user. Also dont assume Unbound should be set to 'on' but rather inform the user they need to configure it before it will be started. --- config/unbound/unbound.inc | 20 ++++++++++---------- config/unbound/unbound.xml | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'config/unbound') diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 7f2fc973..3392c6a2 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -59,9 +59,6 @@ function unbound_initial_setup() { // Setup rc file for startup and shutdown. unbound_rc_setup(); - - // Disable DNSMasq and enable UNBound - $unbound_config['unbound_status'] = "on"; // Set initial interfaces that are allowed to query to lan, if that does not exist set it to the wan if(count($config['interfaces']) > 1) @@ -389,8 +386,16 @@ function fetch_root_hints() { } } +function unbound_validate($post) { + global $config, $input_errors; + + if($_POST['unbound_status'] == "on" && isset($config['dnsmasq']['enable'])) + $input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the Unbound service."; + +} + function unbound_reconfigure() { - global $config,$g; + global $config, $g, $input_errors; $unbound_config = $config['installedpackages']['unbound']['config'][0]; @@ -399,18 +404,13 @@ function unbound_reconfigure() { unbound_control("termstop"); } } else { - if(isset($config['dnsmasq']['enable'])) { - unset($config['dnsmasq']['enable']); - sigkillbypid("{$g['varrun_path']}/dnsmasq.pid", "TERM"); - } if(is_service_running("unbound")) { unbound_control("termstop"); } unbound_resync_config(); unbound_control("start"); unbound_control("forward"); - } - + } } function unbound_uninstall() { diff --git a/config/unbound/unbound.xml b/config/unbound/unbound.xml index b0bfcc16..f7a851eb 100644 --- a/config/unbound/unbound.xml +++ b/config/unbound/unbound.xml @@ -177,6 +177,9 @@ + + unbound_validate($_POST); + unbound_reconfigure(); -- cgit v1.2.3