mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Optimize a bit interface_gateway_group_member
This commit is contained in:
parent
c44d097fa6
commit
c447a9fe34
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user