diff options
author | Ermal <eri@pfsense.org> | 2013-04-12 19:35:25 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-04-12 19:35:25 +0000 |
commit | 58b1112f207ec178f5432bd2849f3985a9040b14 (patch) | |
tree | 32e6125ffa6b9f8aaabb0c6e4dba9528ad35eced /etc | |
parent | c447a9fe34d40400efb10c70204c405acbc534fd (diff) | |
download | pfsense-58b1112f207ec178f5432bd2849f3985a9040b14.zip pfsense-58b1112f207ec178f5432bd2849f3985a9040b14.tar.gz |
Provide a function to get all gateway groups a gateway is member of
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/gwlb.inc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 53cf4f5..b2be6c4 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -994,4 +994,26 @@ function interface_gateway_group_member($interface) { return false; } +function gateway_is_gwgroup_member($name) { + global $config; + + if (is_array($config['gateways']['gateway_group'])) + $groups = $config['gateways']['gateway_group']; + else + return false; + + $members = array(); + foreach($groups as $group) { + if (is_array($group['item'])) { + foreach($group['item'] as $item) { + $elements = explode("|", $item); + $gwname = $elements[0]; + if ($name == $elements[0]) + $members[] = $group['name']; + } + } + } + + return $members; +} ?> |