summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dnsmasq.php
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-11-23 12:26:32 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-11-23 12:26:32 -0500
commit33ed4d60827ccb8d323719bb7d902cc272f5d513 (patch)
treeae6d5bfb30ba16aa3d48156ac441d718d49236d6 /src/usr/local/www/services_dnsmasq.php
parent7409fde65a562234a09d48638bd46fe534f342dc (diff)
downloadpfsense-33ed4d60827ccb8d323719bb7d902cc272f5d513.zip
pfsense-33ed4d60827ccb8d323719bb7d902cc272f5d513.tar.gz
Fixed #5505
Diffstat (limited to 'src/usr/local/www/services_dnsmasq.php')
-rw-r--r--src/usr/local/www/services_dnsmasq.php140
1 files changed, 76 insertions, 64 deletions
diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php
index 61f064b..9c11d4a 100644
--- a/src/usr/local/www/services_dnsmasq.php
+++ b/src/usr/local/www/services_dnsmasq.php
@@ -102,68 +102,80 @@ $a_hosts = &$config['dnsmasq']['hosts'];
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
if ($_POST) {
- $pconfig = $_POST;
- unset($input_errors);
-
- $config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
- $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
- $config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
- $config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
- $config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
- $config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
- $config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
- $config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
- $config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
-
- if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
- if ($_POST['port'] == $config['unbound']['port']) {
- $input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.";
+ if($_POST['apply']) {
+ // Reload filter (we might need to sync to CARP hosts)
+ $retval = filter_configure();
+ /* Update resolv.conf in case the interface bindings exclude localhost. */
+ system_resolvconf_generate();
+ /* Start or restart dhcpleases when it's necessary */
+ system_dhcpleases_configure();
+ if ($retval == 0) {
+ clear_subsystem_dirty('hosts');
+ }
+ } else {
+ $pconfig = $_POST;
+ unset($input_errors);
+
+ $config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
+ $config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
+ $config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
+ $config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
+ $config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
+ $config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
+ $config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
+ $config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
+ $config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
+
+ if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
+ if ($_POST['port'] == $config['unbound']['port']) {
+ $input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.";
+ }
}
- }
-
- if ($_POST['port']) {
- if (is_port($_POST['port'])) {
- $config['dnsmasq']['port'] = $_POST['port'];
- } else {
- $input_errors[] = gettext("You must specify a valid port number");
+
+ if ($_POST['port']) {
+ if (is_port($_POST['port'])) {
+ $config['dnsmasq']['port'] = $_POST['port'];
+ } else {
+ $input_errors[] = gettext("You must specify a valid port number");
+ }
+ } else if (isset($config['dnsmasq']['port'])) {
+ unset($config['dnsmasq']['port']);
}
- } else if (isset($config['dnsmasq']['port'])) {
- unset($config['dnsmasq']['port']);
- }
-
- if (is_array($_POST['interface'])) {
- $config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
- } elseif (isset($config['dnsmasq']['interface'])) {
- unset($config['dnsmasq']['interface']);
- }
-
- if ($config['dnsmasq']['custom_options']) {
- $args = '';
- foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) {
- $args .= escapeshellarg("--{$c}") . " ";
+
+ if (is_array($_POST['interface'])) {
+ $config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
+ } elseif (isset($config['dnsmasq']['interface'])) {
+ unset($config['dnsmasq']['interface']);
}
- exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
- if ($rc != 0) {
- $input_errors[] = gettext("Invalid custom options");
+
+ if ($config['dnsmasq']['custom_options']) {
+ $args = '';
+ foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) {
+ $args .= escapeshellarg("--{$c}") . " ";
+ }
+ exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
+ if ($rc != 0) {
+ $input_errors[] = gettext("Invalid custom options");
+ }
}
- }
-
- if (!$input_errors) {
- write_config();
-
- $retval = 0;
- $retval = services_dnsmasq_configure();
- $savemsg = get_std_save_message($retval);
-
- // Reload filter (we might need to sync to CARP hosts)
- filter_configure();
- /* Update resolv.conf in case the interface bindings exclude localhost. */
- system_resolvconf_generate();
- /* Start or restart dhcpleases when it's necessary */
- system_dhcpleases_configure();
-
- if ($retval == 0) {
- clear_subsystem_dirty('hosts');
+
+ if (!$input_errors) {
+ write_config();
+
+ $retval = 0;
+ $retval = services_dnsmasq_configure();
+ $savemsg = get_std_save_message($retval);
+
+ // Reload filter (we might need to sync to CARP hosts)
+ filter_configure();
+ /* Update resolv.conf in case the interface bindings exclude localhost. */
+ system_resolvconf_generate();
+ /* Start or restart dhcpleases when it's necessary */
+ system_dhcpleases_configure();
+
+ if ($retval == 0) {
+ clear_subsystem_dirty('hosts');
+ }
}
}
}
@@ -327,7 +339,7 @@ $section->addInput(new Form_Checkbox(
'rather than binding to all interfaces and discarding queries to other addresses.' . '<br /><br />' .
'This option does NOT work with IPv6. If set, dnsmasq will not bind to IPv6 addresses.');
-$section->addInput(new Form_TextArea(
+$section->addInput(new Form_Textarea(
'custom_options',
'Custom options',
$pconfig['custom_options']
@@ -480,12 +492,12 @@ endforeach;
//<![CDATA[
events.push(function(){
// On clicking the "Apply" button, submit the main form, not the little form the button lives in
- $('[name=apply]').prop('type', 'button');
+// $('[name=apply]').prop('type', 'button');
- $('[name=apply]').click(function() {
- $('form:last').submit();
- });
-});
+// $('[name=apply]').click(function() {
+// $('form:last').submit();
+// });
+// });
//]]>
</script>
<?php
OpenPOWER on IntegriCloud