diff --git a/plist b/plist index 32862cd9a..a347b3587 100644 --- a/plist +++ b/plist @@ -319,6 +319,12 @@ /usr/local/opnsense/mvc/app/controllers/OPNsense/Diagnostics/forms/ping.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Diagnostics/forms/portprobe.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Diagnostics/forms/traceroute.xml +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/ServiceController.php +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/SettingsController.php +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/IndexController.php +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogDomainOverride.xml +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogHostOverride.xml +/usr/local/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/general.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Firewall/AliasController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Firewall/AliasUtilController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php @@ -713,6 +719,10 @@ /usr/local/opnsense/mvc/app/models/OPNsense/Diagnostics/Traceroute.php /usr/local/opnsense/mvc/app/models/OPNsense/Diagnostics/Traceroute.xml /usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/ACL/ACL.xml +/usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php +/usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.xml +/usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/AliasesField.php +/usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/DomainIPField.php /usr/local/opnsense/mvc/app/models/OPNsense/Dnsmasq/Menu/Menu.xml /usr/local/opnsense/mvc/app/models/OPNsense/Firewall/ACL/ACL.xml /usr/local/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php @@ -909,6 +919,7 @@ /usr/local/opnsense/mvc/app/views/OPNsense/Diagnostics/traffic.volt /usr/local/opnsense/mvc/app/views/OPNsense/Diagnostics/treeview.volt /usr/local/opnsense/mvc/app/views/OPNsense/Diagnostics/vip.volt +/usr/local/opnsense/mvc/app/views/OPNsense/Dnsmasq/index.volt /usr/local/opnsense/mvc/app/views/OPNsense/Firewall/alias.volt /usr/local/opnsense/mvc/app/views/OPNsense/Firewall/alias_util.volt /usr/local/opnsense/mvc/app/views/OPNsense/Firewall/category.volt @@ -1311,6 +1322,7 @@ /usr/local/opnsense/service/conf/actions.d/actions_dhcpd6.conf /usr/local/opnsense/service/conf/actions.d/actions_dhcrelay.conf /usr/local/opnsense/service/conf/actions.d/actions_dns.conf +/usr/local/opnsense/service/conf/actions.d/actions_dnsmasq.conf /usr/local/opnsense/service/conf/actions.d/actions_filter.conf /usr/local/opnsense/service/conf/actions.d/actions_firmware.conf /usr/local/opnsense/service/conf/actions.d/actions_health.conf @@ -2415,9 +2427,6 @@ /usr/local/www/services_dhcp_edit.php /usr/local/www/services_dhcpv6.php /usr/local/www/services_dhcpv6_edit.php -/usr/local/www/services_dnsmasq.php -/usr/local/www/services_dnsmasq_domainoverride_edit.php -/usr/local/www/services_dnsmasq_edit.php /usr/local/www/services_ntpd.php /usr/local/www/services_ntpd_gps.php /usr/local/www/services_ntpd_pps.php diff --git a/src/etc/inc/plugins.inc.d/dnsmasq.inc b/src/etc/inc/plugins.inc.d/dnsmasq.inc index ace2fa2c2..d4535846b 100644 --- a/src/etc/inc/plugins.inc.d/dnsmasq.inc +++ b/src/etc/inc/plugins.inc.d/dnsmasq.inc @@ -144,64 +144,68 @@ function dnsmasq_configure_do($verbose = false) $args .= " --listen-address={$address} "; } - if (!empty($addresses) && isset($config['dnsmasq']['strictbind'])) { + if (!empty($addresses) && !empty($config['dnsmasq']['strictbind'])) { $args .= ' --bind-interfaces '; } } - if (isset($config['dnsmasq']['no_private_reverse'])) { + if (!empty($config['dnsmasq']['no_private_reverse'])) { $args .= ' --bogus-priv '; } foreach (config_read_array('dnsmasq', 'domainoverrides') as $override) { - if ($override['ip'] == '!') { - $override['ip'] = ''; + $ip = $override['ip']; + if (!empty($ip) && !empty($override['port'])) { + $ip .= '#' . $override['port']; + } + if (!empty($ip) && !empty($override['srcip'])) { + $ip .= '@' . $override['srcip']; } - $args .= ' --server=' . escapeshellarg('/' . $override['domain'] . '/' . $override['ip']); + $args .= ' --server=' . escapeshellarg('/' . $override['domain'] . '/' . $ip); if (!isset($config['system']['webgui']['nodnsrebindcheck'])) { $args .= ' --rebind-domain-ok=' . escapeshellarg('/' . $override['domain'] . '/') . ' '; } } - if (isset($config['dnsmasq']['strict_order'])) { + if (!empty($config['dnsmasq']['strict_order'])) { $args .= ' --strict-order '; } else { $args .= ' --all-servers '; } - if (isset($config['dnsmasq']['domain_needed'])) { + if (!empty($config['dnsmasq']['domain_needed'])) { $args .= ' --domain-needed '; } - if (isset($config['dnsmasq']['dnssec'])) { + if (!empty($config['dnsmasq']['dnssec'])) { $args .= ' --dnssec '; $args .= ' --trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D '; $args .= ' --trust-anchor=.,38696,8,2,683D2D0ACB8C9B712A1948B27F741219298D0A450D612C483AF444A4C0FB2B16 '; } - if (isset($config['dnsmasq']['log_queries'])) { + if (!empty($config['dnsmasq']['log_queries'])) { $args .= ' --log-queries=extra '; } - if (isset($config['dnsmasq']['no_hosts'])) { + if (!empty($config['dnsmasq']['no_hosts'])) { $args .= ' --no-hosts '; } - if (isset($config['dnsmasq']['dns_forward_max'])) { + if (!empty($config['dnsmasq']['dns_forward_max'])) { $args .= " --dns-forward-max={$config['dnsmasq']['dns_forward_max']} "; } else { $args .= ' --dns-forward-max=5000 '; } - if (isset($config['dnsmasq']['cache_size'])) { + if (!empty($config['dnsmasq']['cache_size'])) { $args .= " --cache-size={$config['dnsmasq']['cache_size']} "; } else { $args .= ' --cache-size=10000 '; } - if (isset($config['dnsmasq']['local_ttl'])) { + if (!empty($config['dnsmasq']['local_ttl'])) { $args .= " --local-ttl={$config['dnsmasq']['local_ttl']} "; } else { $args .= ' --local-ttl=1 '; @@ -213,9 +217,9 @@ function dnsmasq_configure_do($verbose = false) mwexec("/usr/local/sbin/dnsmasq {$args}"); - if (isset($config['dnsmasq']['regdhcp'])) { + if (!empty($config['dnsmasq']['regdhcp'])) { $domain = $config['system']['domain']; - if (isset($config['dnsmasq']['regdhcpdomain'])) { + if (!empty($config['dnsmasq']['regdhcpdomain'])) { $domain = $config['dnsmasq']['regdhcpdomain']; } mwexecf('/usr/local/opnsense/scripts/dhcp/dnsmasq_watcher.py --domain %s', $domain); @@ -237,24 +241,24 @@ function _dnsmasq_add_host_entries() } foreach ($dnsmasqcfg['hosts'] as $host) { - if ($host['host']) { + if (!empty($host['host'])) { + /* XXX: The question is if we do want "host" as a global alias */ $lhosts .= "{$host['ip']}\t{$host['host']}.{$host['domain']} {$host['host']}\n"; } else { $lhosts .= "{$host['ip']}\t{$host['domain']}\n"; } - if (!isset($host['aliases']) || !is_array($host['aliases']) || !is_array($host['aliases']['item'])) { - continue; - } - foreach ($host['aliases']['item'] as $alias) { - if ($alias['host']) { - $lhosts .= "{$host['ip']}\t{$alias['host']}.{$alias['domain']} {$alias['host']}\n"; - } else { - $lhosts .= "{$host['ip']}\t{$alias['domain']}\n"; + if (!empty($host['aliases'])) { + foreach (explode(",", $host['aliases']) as $alias) { + /** + * XXX: pre migration all hosts where added here as alias, when we combine host.domain we + * miss some information, which is likely not a very good idea anyway. + */ + $lhosts .= "{$host['ip']}\t{$alias}\n"; } } } - if (isset($dnsmasqcfg['regdhcpstatic'])) { + if (!empty($dnsmasqcfg['regdhcpstatic'])) { foreach (plugins_run('static_mapping', [null, true, legacy_interfaces_details()]) as $map) { foreach ($map as $host) { if (empty($host['hostname'])) { @@ -264,7 +268,7 @@ function _dnsmasq_add_host_entries() if (empty($host['domain'])) { $host['domain'] = $config['system']['domain']; } - if (isset($host['ipaddr'])) { + if (!empty($host['ipaddr'])) { $dhosts .= "{$host['ipaddr']}\t{$host['hostname']}.{$host['domain']} {$host['hostname']}\n"; } else { $dhosts .= "{$host['ipaddrv6']}\t{$host['hostname']}.{$host['domain']} {$host['hostname']}\n"; @@ -273,7 +277,7 @@ function _dnsmasq_add_host_entries() } } - if (isset($dnsmasqcfg['dhcpfirst'])) { + if (!empty($dnsmasqcfg['dhcpfirst'])) { file_put_contents('/var/etc/dnsmasq-hosts', $dhosts . $lhosts); } else { file_put_contents('/var/etc/dnsmasq-hosts', $lhosts . $dhosts); diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/ServiceController.php b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/ServiceController.php new file mode 100644 index 000000000..f3d1baec0 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/ServiceController.php @@ -0,0 +1,43 @@ +searchBase('hosts'); + } + + public function getHostAction($uuid = null) + { + return $this->getBase('host', 'hosts', $uuid); + } + + public function setHostAction($uuid) + { + return $this->setBase('host', 'hosts', $uuid); + } + + public function addHostAction() + { + return $this->addBase('host', 'hosts'); + } + + public function delHostAction($uuid) + { + return $this->delBase('hosts', $uuid); + } + + public function searchDomainAction() + { + return $this->searchBase('domainoverrides'); + } + + public function getDomainAction($uuid = null) + { + return $this->getBase('domainoverride', 'domainoverrides', $uuid); + } + + public function setDomainAction($uuid) + { + return $this->setBase('domainoverride', 'domainoverrides', $uuid); + } + + public function addDomainAction() + { + return $this->addBase('domainoverride', 'domainoverrides'); + } + + public function delDomainAction($uuid) + { + return $this->delBase('domainoverride', $uuid); + } +} \ No newline at end of file diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/IndexController.php b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/IndexController.php new file mode 100644 index 000000000..c749b8fc6 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/IndexController.php @@ -0,0 +1,42 @@ +view->generalForm = $this->getForm("general"); + $this->view->formDialogEditHostOverride = $this->getForm("dialogHostOverride"); + $this->view->formGridHostOverride = $this->getFormGrid("dialogHostOverride"); + $this->view->formDialogEditDomainOverride = $this->getForm("dialogDomainOverride"); + $this->view->formGridDomainOverride = $this->getFormGrid("dialogDomainOverride"); + $this->view->pick('OPNsense/Dnsmasq/index'); + } +} \ No newline at end of file diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogDomainOverride.xml b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogDomainOverride.xml new file mode 100644 index 000000000..61d67366a --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogDomainOverride.xml @@ -0,0 +1,32 @@ +
+ + domainoverride.domain + + text + Domain to override (NOTE: this does not have to be a valid TLD!) + + + domainoverride.ip + + text + IP address of the authoritative DNS server for this domain, leave empty to prevent lookups for this domain + + + domainoverride.port + + text + Specify a non standard port number here, leave blank for default + + + domainoverride.srcip + + text + Source IP address for queries to the DNS server for the override domain. Best to leave empty + + + domainoverride.descr + + text + You may enter a description here for your reference (not parsed) + +
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogHostOverride.xml b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogHostOverride.xml new file mode 100644 index 000000000..9e12e4ea6 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/dialogHostOverride.xml @@ -0,0 +1,45 @@ +
+ + host.host + + text + Name of the host, without the domain part. Use "*" to create a wildcard entry. + + + host.domain + + text + Domain of the host, e.g. example.com + + + host.ip + + text + IP address of the host, e.g. 192.168.100.100 or fd00:abcd::1 + + + host.aliases + + select_multiple + + list of aliases (fqdn) + + false + + + + host.descr + + text + You may enter a description here for your reference (not parsed) + + + host.comments + + textbox + You may enter a description here for your reference (not parsed) + + false + + +
diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/general.xml b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/general.xml new file mode 100644 index 000000000..fc6540e76 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/forms/general.xml @@ -0,0 +1,116 @@ +
+ + dnsmasq.enable + + checkbox + Enable Dnsmasq. + + + dnsmasq.port + + text + The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53. + + + dnsmasq.interface + + select_multiple + All (recommended) + + Interface IPs used by Dnsmasq for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. The default behavior is to respond to queries on every available IPv4 and IPv6 address. + + + + dnsmasq.strictbind + + checkbox + If this option is set, Dnsmasq will only bind to the interfaces containing the IP addresses selected above, rather than binding to all interfaces and discarding queries to other addresses. This option does not work with IPv6. If set, Dnsmasq will not bind to IPv6 addresses. + + + dnsmasq.dnssec + + checkbox + + + dnsmasq.regdhcpstatic + + checkbox + If this option is set, then DHCP static mappings will be registered in Dnsmasq, so that their name can be resolved. + + + dnsmasq.dhcpfirst + + checkbox + If this option is set, then DHCP mappings will be resolved before the manual list of names below. This only affects the name given for a reverse lookup (PTR). + + + dnsmasq.no_hosts + + checkbox + Do not read hostnames in /etc/hosts + + + dnsmasq.log_queries + + checkbox + + + dnsmasq.dns_forward_max + + text + 5000 + Set the maximum number of concurrent DNS queries. On configurations with tight resources, this value may need to be reduced. + + + dnsmasq.cache_size + + text + 10000 + Set the size of the cache. Setting the cache size to zero disables caching. Please note that huge cache size impacts performance. + + + dnsmasq.local_ttl + + text + 1 + This option allows a time-to-live (in seconds) to be given for local DNS entries, i.e. /etc/hosts or DHCP leases. This will reduce the load on the server at the expense of clients using stale data under some circumstances. A value of zero will disable client-side caching. + + + header + + + + dnsmasq.strict_order + + checkbox + If this option is set, Dnsmasq will query the DNS servers sequentially in the order specified (System: General Setup: DNS Servers), rather than all at once in parallel. + + + dnsmasq.domain_needed + + checkbox + If this option is set, Dnsmasq will not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. If the name is not known from /etc/hosts or DHCP then a "not found" answer is returned. + + + dnsmasq.no_private_reverse + + checkbox + If this option is set, Dnsmasq will not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. Any entries in the Domain Overrides section forwarding private "n.n.n.in-addr.arpa" names to a specific server are still forwarded. If the IP to name is not known from /etc/hosts, DHCP or a specific domain override then a "not found" answer is immediately returned. + + + header + + + + dnsmasq.regdhcp + + checkbox + If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered in Dnsmasq, so that their name can be resolved. + + + dnsmasq.regdhcpdomain + + text + The domain name to use for DHCP hostname registration. If empty, the default system domain is used. Note that all DHCP leases will be assigned to the same domain. If this is undesired, static DHCP lease registration is able to provide coherent mappings. + +
\ No newline at end of file diff --git a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/ACL/ACL.xml index 9cb4d14fe..4893f34d0 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/ACL/ACL.xml @@ -2,21 +2,10 @@ Services: Dnsmasq DNS: Settings - services_dnsmasq.php* + ui/dnsmasq + api/dnsmasq/* - - Services: Dnsmasq DNS: Edit Domain Override - - services_dnsmasq_domainoverride_edit.php* - - - - Services: Dnsmasq DNS: Edit Host - - services_dnsmasq_edit.php* - - Services: Dnsmasq DNS: Log File diff --git a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php new file mode 100644 index 000000000..21b200fcc --- /dev/null +++ b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php @@ -0,0 +1,39 @@ + + /dnsmasq + 1.0.0 + + + + + + + + + + + + + + Y + + + Y + + + + 0 + + + 0 + + + 0 + + + + Y + N + Y + + + Y + /^(?:(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$/i + A valid domain must be specified. + + + Y + N + + + + + + Y + , + Y + N + + + + + Y + N + Y + + + N + + + + + N + + + + + diff --git a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/AliasesField.php b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/AliasesField.php new file mode 100644 index 000000000..a81f67e30 --- /dev/null +++ b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/AliasesField.php @@ -0,0 +1,65 @@ +item)) { + /* auto convert to simple text blob */ + $tmp = []; + $comments = []; + foreach ($value->item as $child) { + if (empty((string)$child->domain)) { + continue; + } + if (!empty((string)$child->host)) { + $fqdn = sprintf("%s.%s", $child->host, $child->domain); + } else { + $fqdn = (string)$child->domain; + } + $tmp[] = $fqdn; + if (!empty((string)$child->description)) { + $comments[] = sprintf("[%s] %s", $fqdn, $child->description); + } + } + $this->getParentNode()->comments = implode("\n", $comments); + return parent::setValue(implode(",", $tmp)); + } elseif (!empty($value)) { + /* update only */ + return parent::setValue($value); + } + } +} diff --git a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/DomainIPField.php b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/DomainIPField.php new file mode 100644 index 000000000..d564057d6 --- /dev/null +++ b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/DomainIPField.php @@ -0,0 +1,62 @@ + 1 || strpos((string)$value, '@') > 1) { + /* convert legacy input */ + $parts = explode("@", (string)$value); + if (count($parts) > 1) { + $this->getParentNode()->srcip = $parts[1]; + } + $parts = explode("#", $parts[0]); + if (count($parts) > 1) { + $this->getParentNode()->port = $parts[1]; + } + return parent::setValue($parts[0]); + } else { + return parent::setValue($value); + } + } elseif ($value == '!') { + return parent::setValue(''); + } elseif (!empty($value)) { + /* update only */ + return parent::setValue($value); + } + } +} diff --git a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Menu/Menu.xml index e9a0052de..3edeb648d 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Menu/Menu.xml @@ -1,10 +1,7 @@ - - - - + diff --git a/src/opnsense/mvc/app/views/OPNsense/Dnsmasq/index.volt b/src/opnsense/mvc/app/views/OPNsense/Dnsmasq/index.volt new file mode 100644 index 000000000..b409bf851 --- /dev/null +++ b/src/opnsense/mvc/app/views/OPNsense/Dnsmasq/index.volt @@ -0,0 +1,105 @@ +{# + # Copyright (c) 2025 Deciso B.V. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # 1. Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # + # 2. Redistributions in binary form must reproduce the above copyright notice, + # this list of conditions and the following disclaimer in the documentation + # and/or other materials provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + # POSSIBILITY OF SUCH DAMAGE. + #} + + + + + + +
+ +
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_settings'])}} +
+ +
+ {{ partial('layout_partials/base_bootgrid_table', formGridHostOverride)}} +
+ +
+ {{ partial('layout_partials/base_bootgrid_table', formGridDomainOverride)}} +
+
+ +
+
+
+
+ +

+
+
+
+ + +{{ partial("layout_partials/base_dialog",['fields':formDialogEditHostOverride,'id':formGridHostOverride['edit_dialog_id'],'label':lang._('Edit Host Override')])}} +{{ partial("layout_partials/base_dialog",['fields':formDialogEditDomainOverride,'id':formGridDomainOverride['edit_dialog_id'],'label':lang._('Edit Domain Override')])}} diff --git a/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf b/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf new file mode 100644 index 000000000..3f453067e --- /dev/null +++ b/src/opnsense/service/conf/actions.d/actions_dnsmasq.conf @@ -0,0 +1,24 @@ +[start] +command:/usr/local/sbin/pluginctl -s dnsmasq start +parameters: +type:script +message:Starting Dnsmasq + +[stop] +command:/usr/local/sbin/pluginctl -s dnsmasq stop +parameters: +type:script +message:Stopping Dnsmasq + +[restart] +command:/usr/local/sbin/pluginctl -s dnsmasq restart +parameters: +type:script +message:Restarting Dnsmasq +description:Restart Dnsmasq DNS service + +[status] +command:/usr/local/sbin/pluginctl -s dnsmasq status +parameters: +type:script_output +message:Request Dnsmasq status diff --git a/src/wizard/system.xml b/src/wizard/system.xml index 259c0627c..5882d7848 100644 --- a/src/wizard/system.xml +++ b/src/wizard/system.xml @@ -155,7 +155,7 @@ if (!empty($_POST['secondarydnsserver']) && !is_ipaddrv4($_POST['secondarydnsser if (!empty($input_errors)) { $stepid--; } else { - if (isset($config['dnsmasq']['enable'])) { + if (!empty($config['dnsmasq']['enable'])) { unset($config['dnsmasq']['enable']); } } diff --git a/src/www/services_dnsmasq.php b/src/www/services_dnsmasq.php deleted file mode 100644 index 98781aa43..000000000 --- a/src/www/services_dnsmasq.php +++ /dev/null @@ -1,546 +0,0 @@ - - * Copyright (C) 2003-2004 Manuel Kasper - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("guiconfig.inc"); -require_once("interfaces.inc"); -require_once("filter.inc"); -require_once("system.inc"); -require_once("plugins.inc.d/dnsmasq.inc"); - -$a_dnsmasq = &config_read_array('dnsmasq'); - -if ($_SERVER['REQUEST_METHOD'] === 'GET') { - $pconfig = array(); - // booleans - $pconfig['enable'] = isset($a_dnsmasq['enable']); - $pconfig['regdhcp'] = isset($a_dnsmasq['regdhcp']); - $pconfig['regdhcpdomain'] = !empty($a_dnsmasq['regdhcpdomain']) ? $a_dnsmasq['regdhcpdomain'] : null; - $pconfig['regdhcpstatic'] = isset($a_dnsmasq['regdhcpstatic']); - $pconfig['dhcpfirst'] = isset($a_dnsmasq['dhcpfirst']); - $pconfig['strict_order'] = isset($a_dnsmasq['strict_order']); - $pconfig['domain_needed'] = isset($a_dnsmasq['domain_needed']); - $pconfig['no_private_reverse'] = isset($a_dnsmasq['no_private_reverse']); - $pconfig['strictbind'] = isset($a_dnsmasq['strictbind']); - $pconfig['dnssec'] = isset($a_dnsmasq['dnssec']); - $pconfig['log_queries'] = isset($a_dnsmasq['log_queries']); - $pconfig['no_hosts'] = isset($a_dnsmasq['no_hosts']); - // simple text types - $pconfig['port'] = !empty($a_dnsmasq['port']) ? $a_dnsmasq['port'] : ""; - $pconfig['dns_forward_max'] = !empty($a_dnsmasq['dns_forward_max']) ? $a_dnsmasq['dns_forward_max'] : ""; - $pconfig['cache_size'] = isset($a_dnsmasq['cache_size']) ? $a_dnsmasq['cache_size'] : ''; - $pconfig['local_ttl'] = isset($a_dnsmasq['local_ttl']) ? $a_dnsmasq['local_ttl'] : ''; - // arrays - $pconfig['interface'] = !empty($a_dnsmasq['interface']) ? explode(",", $a_dnsmasq['interface']) : array(); - -} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { - $pconfig = $_POST; - $input_errors = array(); - if (isset($pconfig['submit'])) { - // validate - if (!empty($pconfig['regdhcpdomain']) && !is_domain($pconfig['regdhcpdomain'])) { - $input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'."); - } - if (!empty($pconfig['port']) && !is_port($pconfig['port'])) { - $input_errors[] = gettext("You must specify a valid port number"); - } - if (!empty($pconfig['dns_forward_max']) && !is_numericint($pconfig['dns_forward_max'])) { - $input_errors[] = gettext("You must specify a valid maximum number of DNS queries"); - } - if (isset($pconfig['cache_size']) && $pconfig['cache_size'] !== '') { - if (!is_numericint($pconfig['cache_size'])) { - $input_errors[] = gettext("You must specify a valid cache size"); - } elseif (!empty($pconfig['dnssec']) && $pconfig['cache_size'] < 150) { - $input_errors[] = gettext("You must specify a valid cache size of at least 150 when DNSSEC is enabled"); - } - } - if (isset($pconfig['local_ttl']) && $pconfig['local_ttl'] !== '' && !is_numericint($pconfig['local_ttl'])) { - $input_errors[] = gettext("You must specify a valid TTL for local DNS"); - } - - $dnsmasq_port = empty($pconfig['port']) ? "53" : $pconfig['port']; - $port_conflict = service_by_filter(['dns_ports' => $dnsmasq_port]); - if (!empty($pconfig['enable']) && !empty($port_conflict) && $port_conflict['name'] != 'dnsmasq') { - $input_errors[] = sprintf(gettext('%s is currently using this port.'), $port_conflict['description']); - } - - if (count($input_errors) == 0) { - // save form - $a_dnsmasq['enable'] = !empty($pconfig['enable']); - $a_dnsmasq['regdhcp'] = !empty($pconfig['regdhcp']); - $a_dnsmasq['regdhcpstatic'] = !empty($pconfig['regdhcpstatic']); - $a_dnsmasq['dhcpfirst'] = !empty($pconfig['dhcpfirst']); - $a_dnsmasq['strict_order'] = !empty($pconfig['strict_order']); - $a_dnsmasq['domain_needed'] = !empty($pconfig['domain_needed']); - $a_dnsmasq['no_private_reverse'] = !empty($pconfig['no_private_reverse']); - $a_dnsmasq['log_queries'] = !empty($pconfig['log_queries']); - $a_dnsmasq['no_hosts'] = !empty($pconfig['no_hosts']); - $a_dnsmasq['strictbind'] = !empty($pconfig['strictbind']); - $a_dnsmasq['dnssec'] = !empty($pconfig['dnssec']); - if (!empty($pconfig['regdhcpdomain'])) { - $a_dnsmasq['regdhcpdomain'] = $pconfig['regdhcpdomain']; - } elseif (isset($a_dnsmasq['regdhcpdomain'])) { - unset($a_dnsmasq['regdhcpdomain']); - } - if (!empty($pconfig['interface'])) { - $a_dnsmasq['interface'] = implode(",", $pconfig['interface']); - } elseif (isset($a_dnsmasq['interface'])) { - unset($a_dnsmasq['interface']); - } - if (!empty($pconfig['port'])) { - $a_dnsmasq['port'] = $pconfig['port']; - } elseif (isset($a_dnsmasq['port'])) { - unset($a_dnsmasq['port']); - } - if (!empty($pconfig['dns_forward_max'])) { - $a_dnsmasq['dns_forward_max'] = $pconfig['dns_forward_max']; - } elseif (isset($a_dnsmasq['dns_forward_max'])) { - unset($a_dnsmasq['dns_forward_max']); - } - if (isset($pconfig['cache_size']) && $pconfig['cache_size'] !== '') { - $a_dnsmasq['cache_size'] = $pconfig['cache_size']; - } elseif (isset($a_dnsmasq['cache_size'])) { - unset($a_dnsmasq['cache_size']); - } - if (isset($pconfig['local_ttl'])&& $pconfig['local_ttl'] !== '') { - $a_dnsmasq['local_ttl'] = $pconfig['local_ttl']; - } elseif (isset($a_dnsmasq['local_ttl'])) { - unset($a_dnsmasq['local_ttl']); - } - - write_config(); - - system_resolver_configure(); - dnsmasq_configure_do(); - plugins_configure('dhcp'); - - header(url_safe('Location: /services_dnsmasq.php')); - exit; - } - } elseif (isset($pconfig['apply'])) { - filter_configure(); - system_resolver_configure(); - dnsmasq_configure_do(); - plugins_configure('dhcp'); - clear_subsystem_dirty('hosts'); - header(url_safe('Location: /services_dnsmasq.php')); - exit; - } elseif (!empty($pconfig['act']) && $pconfig['act'] == 'del') { - $a_hosts = &config_read_array('dnsmasq', 'hosts'); - if (isset($pconfig['id']) && !empty($a_hosts[$pconfig['id']])) { - unset($a_hosts[$pconfig['id']]); - write_config(); - mark_subsystem_dirty('hosts'); - /* ajax call, do not redirect */ - exit; - } - } elseif (!empty($pconfig['act']) && $pconfig['act'] == 'doverride') { - $a_domainOverrides = &config_read_array('dnsmasq', 'domainoverrides'); - if (isset($pconfig['id']) && !empty($a_domainOverrides[$pconfig['id']])) { - unset($a_domainOverrides[$pconfig['id']]); - write_config(); - mark_subsystem_dirty('hosts'); - /* ajax call, do not redirect */ - exit; - } - } -} - -legacy_html_escape_form_data($pconfig); - -$service_hook = 'dnsmasq'; - -include("head.inc"); - -?> - - - - - - -
-
-
- 0) print_input_errors($input_errors); ?> - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- /> - -
- /> - -
- - -
- /> - - -
- /> - -
- /> - - -
- - -
- /> - - -
- /> - - -
- /> - - -
- /> - - -
- /> - - -
- /> - -
- /> - -
- /> - -
- - -
- - -
- -
-
-
-
-
-
-
-
- - - - - - - - - - - - - $hostent): ?> - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - -
- -
- - -
-
-
-
-
-
-
- - - - - - - - - - - - $doment): ?> - - - - - - - - - - - -
- - - -
- - - - -
- -
-
-
-
-
-
-
- - diff --git a/src/www/services_dnsmasq_domainoverride_edit.php b/src/www/services_dnsmasq_domainoverride_edit.php deleted file mode 100644 index 45812e7b8..000000000 --- a/src/www/services_dnsmasq_domainoverride_edit.php +++ /dev/null @@ -1,211 +0,0 @@ - - * Copyright (C) 2003-2005 Manuel Kasper - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("guiconfig.inc"); -require_once("system.inc"); -require_once("interfaces.inc"); -require_once("plugins.inc.d/dnsmasq.inc"); - -$a_domainOverrides = &config_read_array('dnsmasq', 'domainoverrides'); - -if ($_SERVER['REQUEST_METHOD'] === 'GET') { - if (isset($_GET['id']) && !empty($a_domainOverrides[$_GET['id']])) { - $id = $_GET['id']; - } - $pconfig = array(); - - $pconfig['domain'] = isset($id) && !empty($a_domainOverrides[$id]['domain']) ? $a_domainOverrides[$id]['domain'] : null; - $pconfig['descr'] = !empty($a_domainOverrides[$id]['descr']) ? $a_domainOverrides[$id]['descr'] : null; - if (!isset($id) || empty($a_domainOverrides[$id]['ip'])) { - $pconfig['ip'] = null; - $pconfig['dnssrcip'] = null; - } elseif (!empty($a_domainOverrides[$id]['ip'])) { - // parse ip string, it would be better to have different fields here, but we don't want to break backwards - // compatibility. - $parts = explode("@", $a_domainOverrides[$id]['ip']); - if (count($parts) > 1) { - $pconfig['dnssrcip'] = $parts[1]; - } else { - $pconfig['dnssrcip'] = null; - } - $parts = explode("#", $parts[0]); - if (count($parts) > 1) { - $pconfig['port'] = $parts[1]; - } else { - $pconfig['port'] = null; - } - $pconfig['ip'] = $parts[0]; - - } -} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (isset($_POST['id']) && !empty($a_domainOverrides[$_POST['id']])) { - $id = $_POST['id']; - } - $input_errors= array(); - $pconfig = $_POST; - - /* input validation */ - $reqdfields = explode(" ", "domain ip"); - $reqdfieldsn = array(gettext("Domain"),gettext("IP address")); - - do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors); - - if (!empty($pconfig['domain']) && substr($pconfig['domain'], 0, 6) == '_msdcs') { - $subdomainstr = substr($pconfig['domain'], 7); - if ($subdomainstr && !is_domain($subdomainstr)) { - $input_errors[] = gettext("A valid domain must be specified after _msdcs."); - } - } elseif (!empty($pconfig['domain']) && !is_domain($_POST['domain'])) { - $input_errors[] = gettext("A valid domain must be specified."); - } - if (!empty($pconfig['ip']) && !is_ipaddr($pconfig['ip']) && ($pconfig['ip'] != '#') && ($pconfig['ip'] != '!')) { - $input_errors[] = gettext("A valid IP address must be specified, or # for an exclusion or ! to not forward at all."); - } - if (!empty($pconfig['port']) && !is_port($pconfig['port'])) { - $input_errors[] = gettext("A valid port number must be specified."); - } - if (!empty($pconfig['dnssrcip']) && !in_array($pconfig['dnssrcip'], array_keys(get_configured_ip_addresses()))) { - $input_errors[] = gettext("An interface IP address must be specified for the DNS query source."); - } - if (count($input_errors) == 0) { - $doment = array(); - $doment['domain'] = $pconfig['domain']; - $doment['ip'] = $pconfig['ip']; - if (!empty($pconfig['port'])) { - $doment['ip'] .= "#" . $pconfig['port']; - } - if (!empty($pconfig['dnssrcip'])) { - $doment['ip'] .= "@" . $pconfig['dnssrcip']; - } - $doment['descr'] = $pconfig['descr']; - - if (isset($id)) { - $a_domainOverrides[$id] = $doment; - } else { - $a_domainOverrides[] = $doment; - } - dnsmasq_configure_do(); - plugins_configure('dhcp'); - write_config(); - header(url_safe('Location: /services_dnsmasq.php')); - exit; - } -} - - -$service_hook = 'dnsmasq'; -legacy_html_escape_form_data($pconfig); -include("head.inc"); -?> - - -
-
-
- 0) print_input_errors($input_errors); ?> -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - -
  - - - - - -
-
-
-
-
-
-
-
- diff --git a/src/www/services_dnsmasq_edit.php b/src/www/services_dnsmasq_edit.php deleted file mode 100644 index d6234815f..000000000 --- a/src/www/services_dnsmasq_edit.php +++ /dev/null @@ -1,295 +0,0 @@ - - * Copyright (C) 2003-2004 Manuel Kasper - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("guiconfig.inc"); -require_once("interfaces.inc"); - -$a_hosts = &config_read_array('dnsmasq', 'hosts'); - -if ($_SERVER['REQUEST_METHOD'] === 'GET') { - if (isset($_GET['id']) && !empty($a_hosts[$_GET['id']])) { - $id = $_GET['id']; - } - $config_copy_fieldnames = array('host', 'domain', 'ip', 'descr', 'aliases'); - foreach ($config_copy_fieldnames as $fieldname) { - if (isset($id) && isset($a_hosts[$id][$fieldname])) { - $pconfig[$fieldname] = $a_hosts[$id][$fieldname]; - } else { - $pconfig[$fieldname] = null; - } - } -} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (isset($_POST['id']) && !empty($a_hosts[$_POST['id']])) { - $id = $_POST['id']; - } - $input_errors = array(); - $pconfig = $_POST; - - $pconfig['aliases'] = array(); - if (isset($pconfig['aliases_host'])) { - $pconfig['aliases']['item'] = array(); - foreach ($pconfig['aliases_host'] as $opt_seq => $opt_host) { - if (!empty($opt_host)) { - $pconfig['aliases']['item'][] = array( - 'description' => $pconfig['aliases_description'][$opt_seq], - 'domain' => $pconfig['aliases_domain'][$opt_seq], - 'host' => $opt_host, - ); - } - } - } - - /* input validation */ - $reqdfields = explode(" ", "domain ip"); - $reqdfieldsn = array(gettext("Domain"),gettext("IP address")); - - do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors); - - if (!empty($pconfig['host']) && !is_hostname($pconfig['host'])) { - $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'."); - } - if (!empty($pconfig['domain']) && !is_domain($pconfig['domain'])) { - $input_errors[] = gettext("A valid domain must be specified."); - } - - if (!empty($pconfig['ip']) && !is_ipaddr($pconfig['ip'])) { - $input_errors[] = gettext("A valid IP address must be specified."); - } - - /* validate aliases */ - foreach ($pconfig['aliases']['item'] as $idx => $alias) { - $aliasreqdfields = array('domain'); - $aliasreqdfieldsn = array(gettext("Alias Domain")); - - do_input_validation($alias, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); - if (!empty($alias['host']) && !is_hostname($alias['host'])) { - $input_errors[] = gettext("Hostnames in alias list can only contain the characters A-Z, 0-9 and '-'."); - } - if (!empty($alias['domain']) && !is_domain($alias['domain'])) { - $input_errors[] = gettext("A valid domain must be specified in alias list."); - } - } - - /* check for overlaps */ - foreach ($a_hosts as $hostent) { - if (isset($id) && $a_hosts[$id] === $hostent) { - continue; - } - if (($hostent['host'] == $pconfig['host']) && ($hostent['domain'] == $pconfig['domain']) - && ((is_ipaddrv4($hostent['ip']) && is_ipaddrv4($pconfig['ip'])) || (is_ipaddrv6($hostent['ip']) && is_ipaddrv6($pconfig['ip'])))) { - $input_errors[] = gettext("This host/domain already exists."); - break; - } - } - - if (count($input_errors) == 0) { - $hostent = array(); - $hostent['host'] = $pconfig['host']; - $hostent['domain'] = $pconfig['domain']; - $hostent['ip'] = $pconfig['ip']; - $hostent['descr'] = $pconfig['descr']; - $hostent['aliases'] = $pconfig['aliases']; - - if (isset($id)) { - $a_hosts[$id] = $hostent; - } else { - $a_hosts[] = $hostent; - } - usort($config['dnsmasq']['hosts'], function ($a, $b) { - return strcasecmp($a['host'], $b['host']); - }); - - write_config(); - mark_subsystem_dirty('hosts'); - header(url_safe('Location: /services_dnsmasq.php')); - exit; - } -} - -$service_hook = 'dnsmasq'; -legacy_html_escape_form_data($pconfig); -include("head.inc"); -?> - - - - - -
-
-
- 0) print_input_errors($input_errors); ?> -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - - - - - - - - - - null, 'value' => null, 'type' => null); - } else { - $aliases = $pconfig['aliases']['item']; - } - foreach($aliases as $item):?> - - - - - - - - - - - - - -
-
-
- - - - - -
-
-
- -
  - - " onclick="window.location.href='/services_dnsmasq.php'" /> - - - -
-
-
-
-
-
-
-
- -