diff options
author | Ermal <eri@pfsense.org> | 2013-04-12 19:22:55 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-04-12 19:22:55 +0000 |
commit | c447a9fe34d40400efb10c70204c405acbc534fd (patch) | |
tree | cac9df33c3c942170f14a8fc592babec2750db19 /etc/inc/gwlb.inc | |
parent | c44d097fa66985250afd1f0554296d4c2ef3108e (diff) | |
download | pfsense-c447a9fe34d40400efb10c70204c405acbc534fd.zip pfsense-c447a9fe34d40400efb10c70204c405acbc534fd.tar.gz |
Optimize a bit interface_gateway_group_member
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r-- | etc/inc/gwlb.inc | 12 |
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; } |