summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-11-20 15:55:12 -0500
committerjim-p <jimp@pfsense.org>2013-11-20 15:56:42 -0500
commit186ab4ea1ae72495d52038b08ba118014b3abfab (patch)
treeba8036af6abcd2536756029e2753d0935ca98e21
parent58fac6951c14b9fef3f4ed6b0bf6a884ffedf2fc (diff)
downloadpfsense-186ab4ea1ae72495d52038b08ba118014b3abfab.zip
pfsense-186ab4ea1ae72495d52038b08ba118014b3abfab.tar.gz
Don't flush interface cache on each call of the function when looping through all gateways.
-rw-r--r--etc/inc/gwlb.inc6
-rw-r--r--etc/inc/interfaces.inc8
2 files changed, 8 insertions, 6 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 012b288..da339ce 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -367,6 +367,8 @@ function return_gateways_array($disabled = false, $localhost = false) {
$found_defaultv4 = 0;
$found_defaultv6 = 0;
+ // Ensure the interface cache is up to date first
+ $interfaces = get_interface_arr(true);
$interfaces_v4 = array();
$interfaces_v6 = array();
@@ -422,10 +424,10 @@ function return_gateways_array($disabled = false, $localhost = false) {
/* special treatment for tunnel interfaces */
if ($gateway['ipprotocol'] == "inet6") {
- $gateway['interface'] = get_real_interface($gateway['interface'], "inet6");
+ $gateway['interface'] = get_real_interface($gateway['interface'], "inet6", false, false);
$interfaces_v6[$gateway['friendlyiface']] = $gateway['friendlyiface'];
} else {
- $gateway['interface'] = get_real_interface($gateway['interface']);
+ $gateway['interface'] = get_real_interface($gateway['interface'], "all", false, false);
$interfaces_v4[$gateway['friendlyiface']] = $gateway['friendlyiface'];
}
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 7178a61..6849273 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -72,13 +72,13 @@ function get_interface_arr($flush = false) {
* does_interface_exist($interface): return true or false if a interface is
* detected.
*/
-function does_interface_exist($interface) {
+function does_interface_exist($interface, $flush = true) {
global $config;
if(!$interface)
return false;
- $ints = get_interface_arr(true);
+ $ints = get_interface_arr($flush);
if (in_array($interface, $ints))
return true;
else
@@ -3924,7 +3924,7 @@ function interface_get_wireless_clone($wlif) {
}
}
-function get_real_interface($interface = "wan", $family = "all", $realv6iface = false) {
+function get_real_interface($interface = "wan", $family = "all", $realv6iface = false, $flush = true) {
global $config, $g;
$wanif = NULL;
@@ -3954,7 +3954,7 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface =
// pass the real interface back. This encourages
// the usage of this function in more cases so that
// we can combine logic for more flexibility.
- if(does_interface_exist($interface)) {
+ if(does_interface_exist($interface, $flush)) {
$wanif = $interface;
break;
}
OpenPOWER on IntegriCloud