summaryrefslogtreecommitdiffstats
path: root/etc
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:29 -0500
commit33e71f1087e1885eae9393626a331147eca5c7c7 (patch)
tree5f8a7855ab5d9026c5df1019b1135a2686586c83 /etc
parente924cd7eb2457e7fd7122aecc1f2887824229edb (diff)
downloadpfsense-33e71f1087e1885eae9393626a331147eca5c7c7.zip
pfsense-33e71f1087e1885eae9393626a331147eca5c7c7.tar.gz
Don't flush interface cache on each call of the function when looping through all gateways.
Diffstat (limited to 'etc')
-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 2ede93e..37a9bb4 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
@@ -4224,7 +4224,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;
@@ -4254,7 +4254,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