diff --git a/src/etc/inc/plugins.inc.d/dnsmasq.inc b/src/etc/inc/plugins.inc.d/dnsmasq.inc index dc2165451..ea239a97d 100644 --- a/src/etc/inc/plugins.inc.d/dnsmasq.inc +++ b/src/etc/inc/plugins.inc.d/dnsmasq.inc @@ -47,6 +47,8 @@ function dnsmasq_configure() function dnsmasq_services() { + global $config; + $services = []; if (!dnsmasq_enabled()) { @@ -55,6 +57,7 @@ function dnsmasq_services() $pconfig = []; $pconfig['name'] = 'dnsmasq'; + $pconfig['ports'] = [$config['dnsmasq']['port'] ?? '53']; $pconfig['description'] = gettext('Dnsmasq DNS'); $pconfig['php']['restart'] = ['dnsmasq_configure_do']; $pconfig['php']['start'] = ['dnsmasq_configure_do']; diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc index 8c1967306..50240c3d0 100644 --- a/src/etc/inc/plugins.inc.d/unbound.inc +++ b/src/etc/inc/plugins.inc.d/unbound.inc @@ -38,31 +38,34 @@ function unbound_enabled() function unbound_configure() { - return array( - 'bootup' => array('unbound_configure_do'), - 'dns' => array('unbound_configure_do'), - 'early' => array('unbound_cache_flush'), - 'local' => array('unbound_configure_do'), - 'newwanip' => array('unbound_configure_do:2'), - 'unbound_start' => array('unbound_configure_do'), - 'unbound_stop' => array('unbound_service_stop'), - ); + return [ + 'bootup' => ['unbound_configure_do'], + 'dns' => ['unbound_configure_do'], + 'early' => ['unbound_cache_flush'], + 'local' => ['unbound_configure_do'], + 'newwanip' => ['unbound_configure_do:2'], + 'unbound_start' => ['unbound_configure_do'], + 'unbound_stop' => ['unbound_service_stop'], + ]; } function unbound_services() { - $services = array(); + $services = []; if (!unbound_enabled()) { return $services; } - $pconfig = array(); + $mdl = new \OPNsense\Unbound\Unbound(); + + $pconfig = []; $pconfig['name'] = 'unbound'; + $pconfig['ports'] = [(string)$mdl->general->port]; $pconfig['description'] = gettext('Unbound DNS'); - $pconfig['php']['restart'] = array('unbound_configure_do'); - $pconfig['php']['start'] = array('unbound_configure_do'); - $pconfig['php']['stop'] = array('unbound_service_stop'); + $pconfig['php']['restart'] = ['unbound_configure_do']; + $pconfig['php']['start'] = ['unbound_configure_do']; + $pconfig['php']['stop'] = ['unbound_service_stop']; $pconfig['pidfile'] = '/var/run/unbound.pid'; $services[] = $pconfig; @@ -71,14 +74,14 @@ function unbound_services() function unbound_xmlrpc_sync() { - $result = array(); + $result = []; - $result[] = array( - 'description' => gettext('Unbound DNS'), + $result[] = [ 'section' => 'unbound,OPNsense.unboundplus', + 'description' => gettext('Unbound DNS'), + 'services' => ['unbound'], 'id' => 'dnsresolver', - 'services' => ["unbound"], - ); + ]; return $result; }