summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-04-12 19:22:55 +0000
committerErmal <eri@pfsense.org>2013-04-12 19:22:55 +0000
commitc447a9fe34d40400efb10c70204c405acbc534fd (patch)
treecac9df33c3c942170f14a8fc592babec2750db19
parentc44d097fa66985250afd1f0554296d4c2ef3108e (diff)
downloadpfsense-c447a9fe34d40400efb10c70204c405acbc534fd.zip
pfsense-c447a9fe34d40400efb10c70204c405acbc534fd.tar.gz
Optimize a bit interface_gateway_group_member
-rw-r--r--etc/inc/gwlb.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index d7e1f53..53cf4f5 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -970,23 +970,27 @@ function validate_address_family($ipaddr, $gwname) {
/* check if a interface is part of a gateway group */
function interface_gateway_group_member($interface) {
global $config;
- $realif = get_real_interface($interface);
- if(is_array($config['gateways']['gateway_group']))
+
+ if (is_array($config['gateways']['gateway_group']))
$groups = $config['gateways']['gateway_group'];
else
return false;
+ $gateways_arr = return_gateways_array(false, true);
foreach($groups as $group) {
if(is_array($group['item'])) {
foreach($group['item'] as $item) {
$elements = explode("|", $item);
$gwname = $elements[0];
- $gwif = get_real_interface(lookup_gateway_interface_by_name($gwname));
- if($gwif == $realif)
+ if ($interface == $gateways_arr[$gwname]['interface']) {
+ unset($gateways_arr);
return true;
+ }
}
}
}
+ unset($gateways_arr);
+
return false;
}
OpenPOWER on IntegriCloud