dhcpdv4: performance improvements, only call interfaces_staticarp_configure() when staticarp is used on this interface, prevent excessive legacy_interfaces_details() calls for https://github.com/opnsense/core/issues/3567

This commit is contained in:
Ad Schellevis 2019-07-12 16:46:19 +02:00
parent 62f1bb21f7
commit c72e682d21

View File

@ -598,10 +598,12 @@ EOD;
* failover peer "bleh" entries
*/
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
interfaces_staticarp_configure($dhcpif);
if (!isset($dhcpifconf['enable'])) {
continue;
}
if (!empty($config['dhcpd'][$dhcpif]['staticmap'])) {
interfaces_staticarp_configure($dhcpif);
}
if (!empty($dhcpifconf['failover_peerip'])) {
$intip = get_interface_ip($dhcpif);
@ -662,6 +664,7 @@ EOPP;
}
$iflist = get_configured_interface_with_descr();
$gwObject = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
if (!isset($dhcpifconf['enable']) || !isset($iflist[$dhcpif])) {
@ -895,7 +898,7 @@ EOPP;
if (!empty($dhcpifconf['gateway'])) {
$routers = $dhcpifconf['gateway'] != "none" ? $dhcpifconf['gateway'] : null;
} elseif ((new \OPNsense\Routing\Gateways(legacy_interfaces_details()))->hasGateways("inet")) {
} elseif ($gwObject->hasGateways("inet")) {
// by default, add interface address in "option routers"
$routers = $ifcfgip;
} else {