diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-22 13:07:03 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-22 13:07:03 -0300 |
commit | 7386f8a008e0a8cac5cd91012728b02cbda2922f (patch) | |
tree | b0f4c4e5dd0e17756a0ef40d730d115f2744a7f4 /src | |
parent | 4be90da55aee071798b2278a102e454a75864955 (diff) | |
parent | e83c9b733c86f39a14a874b115f2b8e0adc952e7 (diff) | |
download | pfsense-7386f8a008e0a8cac5cd91012728b02cbda2922f.zip pfsense-7386f8a008e0a8cac5cd91012728b02cbda2922f.tar.gz |
Merge pull request #3568 from doktornotor/patch-7
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/system.inc | 9 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 10 | ||||
-rw-r--r-- | src/usr/local/www/services_dnsmasq.php | 5 | ||||
-rw-r--r-- | src/usr/local/www/services_unbound.php | 5 |
4 files changed, 26 insertions, 3 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 028583b..61b6a77 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -570,12 +570,15 @@ function system_hosts_generate() { function system_dhcpleases_configure() { global $config, $g; - + if (!function_exists('is_dhcp_server_enabled')) { + require_once('pfsense-utils.inc'); + } $pidfile = "{$g['varrun_path']}/dhcpleases.pid"; /* Start the monitoring process for dynamic dhcpclients. */ - if ((isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcp'])) || - (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcp']))) { + if (((isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcp'])) || + (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcp']))) && + (is_dhcp_server_enabled())) { /* Make sure we do not error out */ mwexec("/bin/mkdir -p {$g['dhcpd_chroot_path']}/var/db"); if (!file_exists("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases")) { diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index bed5cfb..3e57cea 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -417,6 +417,16 @@ if (isset($_POST['save'])) { $input_errors[] = sprintf(gettext("The DHCP relay on the %s interface must be disabled before enabling the DHCP server."), $iflist[$if]); } + /* If disabling DHCP Server, make sure that DHCP registration isn't enabled for DNS forwarder/resolver */ + if (!$_POST['enable']) { + if (isset($config['dnsmasq']['enable']) && (isset($config['dnsmasq']['regdhcp']) || isset($config['dnsmasq']['regdhcpstatic']) || isset($config['dnsmasq']['dhcpfirst']))) { + $input_errors[] = gettext("Disable DHCP Registration features in DNS Forwarder before disabling DHCP Server."); + } + if (isset($config['unbound']['enable']) && (isset($config['unbound']['regdhcp']) || isset($config['unbound']['regdhcpstatic']))) { + $input_errors[] = gettext("Disable DHCP Registration features in DNS Resolver before disabling DHCP Server."); + } + } + // If nothing is wrong so far, and we have range from and to, then check conditions related to the values of range from and to. if (!$input_errors && $_POST['range_from'] && $_POST['range_to']) { /* make sure the range lies within the current subnet */ diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php index c834457..ff664e5 100644 --- a/src/usr/local/www/services_dnsmasq.php +++ b/src/usr/local/www/services_dnsmasq.php @@ -34,6 +34,7 @@ require_once("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); +require_once("pfsense-utils.inc"); require_once("shaper.inc"); require_once("system.inc"); @@ -147,6 +148,10 @@ if ($_POST['save']) { } } + if ((isset($_POST['regdhcp']) || isset($_POST['regdhcpstatic']) || isset($_POST['dhcpfirst'])) && !is_dhcp_server_enabled()) { + $input_errors[] = gettext("DHCP Server must be enabled for DHCP Registration to work in DNS Forwarder."); + } + if ($_POST['port']) { if (is_port($_POST['port'])) { $config['dnsmasq']['port'] = $_POST['port']; diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php index 5c3caa1..e000057 100644 --- a/src/usr/local/www/services_unbound.php +++ b/src/usr/local/www/services_unbound.php @@ -29,6 +29,7 @@ require_once("guiconfig.inc"); require_once("unbound.inc"); +require_once("pfsense-utils.inc"); require_once("system.inc"); if (!is_array($config['unbound'])) { @@ -153,6 +154,10 @@ if ($_POST['save']) { $pconfig['active_interface'] = implode(",", $pconfig['active_interface']); } + if ((isset($pconfig['regdhcp']) || isset($pconfig['regdhcpstatic'])) && !is_dhcp_server_enabled()) { + $input_errors[] = gettext("DHCP Server must be enabled for DHCP Registration to work in DNS Resolver."); + } + $display_custom_options = $pconfig['custom_options']; $pconfig['custom_options'] = base64_encode(str_replace("\r\n", "\n", $pconfig['custom_options'])); |