diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php index b7e32bf4e..ea4511c4f 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php @@ -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)) {