Skip to content

Commit e83c9b7

Browse files
authored
Check that DHCP registration isn't enabled for DNS forwarder/resolver when disabling DHCP server
1 parent c6d03f0 commit e83c9b7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/usr/local/www/services_dhcp.php

+10
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ function validate_partial_mac_list($maclist) {
417417
$input_errors[] = sprintf(gettext("The DHCP relay on the %s interface must be disabled before enabling the DHCP server."), $iflist[$if]);
418418
}
419419

420+
/* If disabling DHCP Server, make sure that DHCP registration isn't enabled for DNS forwarder/resolver */
421+
if (!$_POST['enable']) {
422+
if (isset($config['dnsmasq']['enable']) && (isset($config['dnsmasq']['regdhcp']) || isset($config['dnsmasq']['regdhcpstatic']) || isset($config['dnsmasq']['dhcpfirst']))) {
423+
$input_errors[] = gettext("Disable DHCP Registration features in DNS Forwarder before disabling DHCP Server.");
424+
}
425+
if (isset($config['unbound']['enable']) && (isset($config['unbound']['regdhcp']) || isset($config['unbound']['regdhcpstatic']))) {
426+
$input_errors[] = gettext("Disable DHCP Registration features in DNS Resolver before disabling DHCP Server.");
427+
}
428+
}
429+
420430
// 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.
421431
if (!$input_errors && $_POST['range_from'] && $_POST['range_to']) {
422432
/* make sure the range lies within the current subnet */

0 commit comments

Comments
 (0)