Commit 6d916416 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) kill "interface cache", let's not try to cache things that may change...

(legacy) kill "interface cache", let's not try to cache things that may change during the session... all for saving a ifconfig call.

related to, https://github.com/opnsense/core/issues/451 (try to avoid smilar issues)
parent 50dc2e57
......@@ -171,9 +171,6 @@ function filter_configure_sync($delete_states_if_needed = true)
filter_pflog_start();
update_filter_reload_status(gettext("Initializing"));
/* invalidate interface cache */
get_interface_arr(true);
/* Get interface list to work with. */
filter_generate_optcfg_array();
if(file_exists("/var/run/booting")) {
......
......@@ -431,8 +431,7 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
$found_defaultv4 = 0;
$found_defaultv6 = 0;
// Ensure the interface cache is up to date first
$interfaces = get_interface_arr(true);
$interfaces = legacy_interface_listget();
$interfaces_v4 = array();
$interfaces_v6 = array();
......
......@@ -97,21 +97,6 @@ function interfaces_bring_up($interface)
legacy_interface_flags($interface, 'up');
}
/*
* Return the interface array
*/
function get_interface_arr($flush = false)
{
global $interface_arr_cache;
/* If the cache doesn't exist, build it */
if (!isset($interface_arr_cache) or $flush) {
$interface_arr_cache = legacy_interface_listget();
}
return $interface_arr_cache;
}
function interface_override_flags()
{
global $config;
......@@ -126,24 +111,14 @@ function interface_override_flags()
);
}
function does_interface_exist($interface, $flush = true)
function does_interface_exist($interface)
{
global $config;
if(!$interface) {
$ints = legacy_interface_listget();
if (empty($interface) || $ints == null || !in_array($interface, $ints)) {
return false;
}
$ints = get_interface_arr($flush);
if ($ints == null) {
return false;
}
if (!in_array($interface, $ints)) {
return false;
}
} else {
return true;
}
}
......@@ -310,9 +285,6 @@ function interface_vlan_configure(&$vlan)
interfaces_bring_up($vlanif);
/* invalidate interface cache */
get_interface_arr(true);
/* XXX: ermal -- for now leave it here at the moment it does not hurt. */
interfaces_bring_up($if);
......@@ -366,9 +338,6 @@ function interface_qinq_configure(&$vlan, $fd = NULL) {
fwrite($fd, "connect {$qinqif}: {$vlanif}qinq: upper nomatch\n");
}
/* invalidate interface cache */
get_interface_arr(true);
if (!stristr($qinqif, "_vlan"))
mwexec("/sbin/ifconfig {$qinqif} promisc\n");
......@@ -434,9 +403,6 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr) {
fwrite($fd, "msg {$if}h{$tag}: setifname \"{$vlanif}\"\n");
fwrite($fd, "msg {$if}h{$tag}: set {$macaddr}\n");
/* invalidate interface cache */
get_interface_arr(true);
return $vlanif;
}
......@@ -2990,7 +2956,6 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
}
/* invalidate interface/ip/sn cache */
get_interface_arr(true);
unset($interface_ip_arr_cache[$realif]);
unset($interface_sn_arr_cache[$realif]);
unset($interface_ipv6_arr_cache[$realif]);
......
......@@ -152,10 +152,11 @@ function setup_polling()
function setup_microcode() {
/* if list */
$ifs = get_interface_arr();
$ifs = legacy_interface_listget();
foreach($ifs as $if)
foreach($ifs as $if) {
enable_hardware_offloading($if);
}
}
/****f* legacy/get_carp_status
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment