Project

General

Profile

« Previous | Next » 

Revision cdb0df65

Added by Seth Mos almost 13 years ago

Add function that checks if the interface is part of a gateway group.

View differences:

etc/inc/gwlb.inc
975 975
	return false;
976 976
}
977 977

  
978
/* check if a interface is part of a gateway group */
979
function interface_gateway_group_member($interface) {
980
	global $config;
981
	$realif = get_real_interface($interface);
982
	if(is_array($config['gateways']['gateway_group']))
983
		$groups = $config['gateways']['gateway_group'];
984
	else
985
		return false;
986

  
987
	foreach($groups as $group) {
988
		if(is_array($group['item'])) {
989
			foreach($group['item'] as $item) {
990
				$elements = explode("|", $item);
991
				$gwname = $elements[0];
992
				$gwif = lookup_gateway_interface_by_name($gwname);
993
				if($gwif == $interface)
994
				return $group['name'];
995
			}
996
		}
997
	}
998
	return false;
999
}
978 1000

  
979 1001
?>

Also available in: Unified diff