Commit 4a435261 authored by Franco Fichtner's avatar Franco Fichtner

dns: consolidate previous, remove service names hack... #1491

... that was written at a time when either Unbound or Dnsmasq
could run, but nowadays both can run in tandem which "breaks"
the service widget on the log page.  The log page now belongs
to the Unbound service.
parent 2e19f4ec
......@@ -1720,32 +1720,21 @@ function services_get()
return $services;
}
function find_service_by_name($names, $filter = array())
function find_service_by_name($name, $filter = array())
{
if (!is_array($names)) {
$names = array($names);
}
$services = services_get();
foreach ($services as $service) {
foreach ($names as $name) {
if ($service['name'] != $name) {
continue;
}
if (!count($filter)) {
/* force match if filter wasn't set (standard behaviour) */
$filter['name'] = $name;
}
foreach ($filter as $key => $value) {
if (isset($service[$key]) && $service[$key] == $value) {
/*
* First match wins, $names is only used
* to probe similar services that exclude
* each other.
*/
return $service;
}
if ($service['name'] != $name) {
continue;
}
if (!count($filter)) {
/* force match if filter wasn't set (standard behaviour) */
$filter['name'] = $name;
}
foreach ($filter as $key => $value) {
if (isset($service[$key]) && $service[$key] == $value) {
return $service;
}
}
}
......
......@@ -232,7 +232,7 @@
</Leases>
</DHCPv6>
<DNSTools VisibleName="DNS Tools" cssClass="fa fa-tags fa-fw">
<DNSFilter VisibleName="OpenDNS" url="/services_opendns.php"/>
<OpenDNS VisibleName="OpenDNS" url="/services_opendns.php"/>
</DNSTools>
<Diagnostics order="900" cssClass="fa fa-medkit fa-fw" url="/status_services.php">
<All url="/status_services.php?*" visibility="hidden"/>
......
<menu>
<Services>
<DNSForwarder VisibleName="Dnsmasq DNS" url="/services_dnsmasq.php" cssClass="fa fa-tags fa-fw">
<Dnsmasq VisibleName="Dnsmasq DNS" url="/services_dnsmasq.php" cssClass="fa fa-tags fa-fw">
<Hosts url="/services_dnsmasq_edit.php*" visibility="hidden"/>
<Domains url="/services_dnsmasq_domainoverride_edit.php*" visibility="hidden"/>
</DNSForwarder>
</Dnsmasq>
</Services>
</menu>
<menu>
<Services>
<DNSResolver VisibleName="Unbound DNS" cssClass="fa fa-tags fa-fw">
<Unbound VisibleName="Unbound DNS" cssClass="fa fa-tags fa-fw">
<General order="10" url="/services_unbound.php"/>
<Overrides order="20" url="/services_unbound_overrides.php">
<Hosts url="/services_unbound_host_edit.php*" visibility="hidden"/>
......@@ -11,6 +11,6 @@
<All url="/services_unbound_acls.php*" visibility="hidden"/>
</ACL>
<LogFile VisibleName="Log File" order="50" url="/diag_logs_resolver.php"/>
</DNSResolver>
</Unbound>
</Services>
</menu>
......@@ -3,6 +3,6 @@
$logfile = '/var/log/resolver.log';
$logclog = true;
$service_hook = array('dnsmasq', 'unbound');
$service_hook = 'unbound';
require_once 'diag_logs_template.inc';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment