summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/gwlb.inc22
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;
+}
?>
OpenPOWER on IntegriCloud