diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc index 94d881784..23698653d 100644 --- a/src/etc/inc/plugins.inc.d/unbound.inc +++ b/src/etc/inc/plugins.inc.d/unbound.inc @@ -255,10 +255,13 @@ EOF; $include_dhcpleases = ''; } + $unbound_mdl = new \OPNsense\Unbound\Unbound(); + $unbound_enabled = (string)$unbound_mdl->forwarding->enabled; + $forward_conf = ''; $forward_local = ''; $resolv_conf_root = ''; - if (isset($config['unbound']['forwarding'])) { + if ($unbound_enabled) { $dnsservers = get_nameservers(); if (!empty($dnsservers)) { diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php index 3051f7939..226d8592e 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php @@ -40,37 +40,6 @@ class SettingsController extends ApiMutableModelControllerBase private $type = 'dot'; - public function toggleSystemForwardAction() - { - if ($this->request->isPost() && $this->request->hasPost('forwarding')) { - $this->sessionClose(); - Config::getInstance()->lock(); - $config = Config::getInstance()->object(); - - $val = $this->request->getPost('forwarding')['enabled']; - - /* Write to config exactly as legacy would */ - $config->unbound->forwarding = !empty($val); - if ($val != "1") { - /* legacy uses isset() */ - unset($config->unbound->forwarding); - } - - /* save and release lock */ - Config::getInstance()->save(); - } - } - - public function getSystemForwardAction() - { - $config = Config::getInstance()->object(); - return array("forwarding" => - array( "enabled" => - empty($config->unbound->forwarding) ? 0 : 1 - ) - ); - } - public function getNameserversAction() { if ($this->request->isGet()) { diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/forwarding.xml b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/forwarding.xml index c40ece719..03786bac6 100755 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/forwarding.xml +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/forwarding.xml @@ -1,6 +1,6 @@