From 4b9807014bedda17e0f854b6c7626966bd71d0ea Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 27 Apr 2017 12:47:53 -0300 Subject: Checks for DHCP Relay being enabled/disabled should be skipped when editting an additional pool --- src/usr/local/www/services_dhcp.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index 92a3403..3de08c4 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -412,18 +412,30 @@ if (isset($_POST['save'])) { } } - /* If enabling DHCP Server, make sure that the DHCP Relay isn't enabled on this interface */ - if ($_POST['enable'] && isset($config['dhcrelay']['enable']) && (stristr($config['dhcrelay']['interface'], $if) !== false)) { - $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($pool) || !is_numeric($pool)) && $act != "newpool") { + /* If enabling DHCP Server, make sure that the DHCP Relay isn't enabled on this interface */ + if ($_POST['enable'] && isset($config['dhcrelay']['enable']) && + (stristr($config['dhcrelay']['interface'], $if) !== false)) { + $input_errors[] = sprintf(gettext( + "The DHCP relay on the %s interface must be disabled before enabling the DHCP server."), + $iflist[$if]); } - 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 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."); + } } } -- cgit v1.1