diff options
author | smos <seth.mos@dds.nl> | 2012-09-13 07:04:57 +0200 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2012-09-13 07:04:57 +0200 |
commit | cdb0df65b7f8962ba9483e9a3a4e7ef43a9abde6 (patch) | |
tree | 8687b1933ca4e98e341260b6b6e56316a65536ba /etc/inc/gwlb.inc | |
parent | 1be0e2da021703526f1c2a1ee2f29f424d5c6bf9 (diff) | |
download | pfsense-cdb0df65b7f8962ba9483e9a3a4e7ef43a9abde6.zip pfsense-cdb0df65b7f8962ba9483e9a3a4e7ef43a9abde6.tar.gz |
Add function that checks if the interface is part of a gateway group.
Diffstat (limited to 'etc/inc/gwlb.inc')
-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 dd6b8e6..593d522 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -975,5 +975,27 @@ function validate_address_family($ipaddr, $gwname) { return false; } +/* 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'])) + $groups = $config['gateways']['gateway_group']; + else + return false; + + foreach($groups as $group) { + if(is_array($group['item'])) { + foreach($group['item'] as $item) { + $elements = explode("|", $item); + $gwname = $elements[0]; + $gwif = lookup_gateway_interface_by_name($gwname); + if($gwif == $interface) + return $group['name']; + } + } + } + return false; +} ?> |