mirror of
https://github.com/lucaspalomodevelop/opnsense-core.git
synced 2026-03-13 00:07:27 +00:00
Services: ISC DHCPv4: hide menu items when dnsmasq is enabled to improve "out of the box" experience. closes https://github.com/opnsense/core/issues/8329
This commit is contained in:
parent
413f49c3ef
commit
0d6aa56527
@ -169,6 +169,27 @@ class MenuSystem
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* temporary legacy glue to remove isc dhcp4 settings when not enabled and Dnsmasq is configured as dhcp
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
private function isc_v4_enabled($if)
|
||||
{
|
||||
$config = Config::getInstance()->object();
|
||||
if (isset($config->dhcpd) && isset($config->dhcpd->$if) && !empty((string)$config->dhcpd->$if->enable)) {
|
||||
/* still configured on intreface */
|
||||
return true;
|
||||
} elseif (isset($config->dnsmasq) && empty((string)$config->dnsmasq->enable)) {
|
||||
/* dnsmasq not configured at all */
|
||||
return true;
|
||||
} elseif (isset($config->dnsmasq) && !empty((string)$config->dnsmasq->interface)) {
|
||||
/* dnsmasq configured, but only on selected interfaces */
|
||||
return !in_array($if, explode(',', $config->dnsmasq->interface));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* construct a new menu
|
||||
* @throws MenuInitException
|
||||
@ -238,7 +259,10 @@ class MenuSystem
|
||||
}
|
||||
// "Services: DHCPv[46]" menu tab:
|
||||
if (empty($node->virtual) && isset($node->enable)) {
|
||||
if (!empty(filter_var($node->ipaddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))) {
|
||||
if (
|
||||
$this->isc_v4_enabled($key) &&
|
||||
!empty(filter_var($node->ipaddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
|
||||
) {
|
||||
$iftargets['dhcp4'][$key] = !empty($node->descr) ? (string)$node->descr : strtoupper($key);
|
||||
}
|
||||
if (!empty(filter_var($node->ipaddrv6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) || !empty($node->dhcpd6track6allowoverride)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user