From 3772ca0a0cb345dec8ad4dbb75a196534be14768 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 13 Jan 2021 17:40:00 +0100 Subject: [PATCH] opendns: add standalone mode; closes #3857 --- src/etc/inc/plugins.inc.d/opendns.inc | 2 +- src/www/services_opendns.php | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/opendns.inc b/src/etc/inc/plugins.inc.d/opendns.inc index 7164d5570..1fe95a2c2 100644 --- a/src/etc/inc/plugins.inc.d/opendns.inc +++ b/src/etc/inc/plugins.inc.d/opendns.inc @@ -45,7 +45,7 @@ function opendns_configure_do($verbose = false) flush(); } $result = opendns_register($config['opendns']); - syslog(LOG_NOTICE, "opendns response : " . $result); + syslog(LOG_NOTICE, "opendns response: $result"); if ($verbose) { echo "done.\n"; } diff --git a/src/www/services_opendns.php b/src/www/services_opendns.php index 06f60805b..f64c608b3 100644 --- a/src/www/services_opendns.php +++ b/src/www/services_opendns.php @@ -1,7 +1,7 @@ + * Copyright (c) 2015-2021 Franco Fichtner * Copyright (c) 2008 Tellnet AG * All rights reserved. * @@ -36,6 +36,7 @@ config_read_array('opendns'); if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig['enable'] = isset($config['opendns']['enable']); + $pconfig['standalone'] = isset($config['opendns']['standalone']); $pconfig['username'] = !empty($config['opendns']['username']) ? $config['opendns']['username'] : null; $pconfig['password'] = !empty($config['opendns']['password']) ? $config['opendns']['password'] : null; $pconfig['host'] = !empty($config['opendns']['host']) ? $config['opendns']['host'] : null; @@ -63,10 +64,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $test_results = explode("\r\n", opendns_register($pconfig)); } elseif (count($input_errors) == 0) { $config['opendns']['enable'] = !empty($pconfig['enable']); + $config['opendns']['standalone'] = !empty($pconfig['standalone']); $config['opendns']['username'] = $pconfig['username']; $config['opendns']['password'] = $pconfig['password']; $config['opendns']['host'] = $pconfig['host']; - if ($config['opendns']['enable']) { + if ($config['opendns']['standalone']) { + /* nothing to do, keep system state */ + } elseif ($config['opendns']['enable']) { $config['system']['dnsserver'] = array(); $v4_server = array('208.67.222.222', '208.67.220.220'); $v6_server = array('2620:0:ccc::2', '2620:0:ccd::2'); @@ -137,7 +141,7 @@ include 'head.inc'; /> - +