From ab1112da4c1c8dc9c22486d0d69dca9cd1216cd2 Mon Sep 17 00:00:00 2001 From: smos Date: Sat, 2 Jun 2012 21:27:03 +0200 Subject: [PATCH] The gateway groups array now knows about vips to be tied into that gateway group so we can tie the groups into services. Redmine ticket #1965 --- etc/inc/gwlb.inc | 6 +++ usr/local/www/system_gateway_groups_edit.php | 41 +++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 68b3e48c8b..dd79de2c37 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -631,6 +631,7 @@ function return_gateway_groups_array() { $gateways_status = return_gateways_status(true); $gateways_arr = return_gateways_array(); $gateway_groups_array = array(); + $carplist = get_configured_carp_interface_list(); if (isset($config['system']['gw_switch_default'])) { /* @@ -694,6 +695,9 @@ function return_gateway_groups_array() { $itemsplit = explode("|", $item); $tier = $itemsplit[1]; $gwname = $itemsplit[0]; + $vipname = $itemsplit[2]; + if(is_ipaddr($carplist[$vipname])) + $gwvip_arr[$group['name']][$gwname] = $vipname; /* Do it here rather than reiterating again the group in case no member is up. */ $backupplan[$tier][] = $gwname; @@ -757,6 +761,8 @@ function return_gateway_groups_array() { $groupmember['int'] = $int; $groupmember['gwip'] = $gatewayip; $groupmember['weight'] = isset($gateway['weight']) ? $gateway['weight'] : 1; + if($gwvip_arr[$group['name']][$gwname] <> "") + $groupmember['vip'] = $gwvip_arr[$group['name']][$gwname]; $gateway_groups_array[$group['name']]['ipprotocol'] = $gateway['ipprotocol']; $gateway_groups_array[$group['name']][] = $groupmember; } diff --git a/usr/local/www/system_gateway_groups_edit.php b/usr/local/www/system_gateway_groups_edit.php index b37729dba8..242e9ea6aa 100755 --- a/usr/local/www/system_gateway_groups_edit.php +++ b/usr/local/www/system_gateway_groups_edit.php @@ -46,6 +46,7 @@ if (!is_array($config['gateways']['gateway_group'])) $a_gateway_groups = &$config['gateways']['gateway_group']; $a_gateways = return_gateways_array(); +$carplist = get_configured_carp_interface_list(); $categories = array('down' => gettext("Member Down"), 'downloss' => gettext("Packet Loss"), @@ -179,6 +180,7 @@ include("head.inc"); if($gateway['ipprotocol'] != $family) continue; } + $interface = $gateway['friendlyiface']; $selected = array(); foreach((array)$pconfig['item'] as $item) { $itemsplit = explode("|", $item); @@ -189,18 +191,18 @@ include("head.inc"); $selected[0] = "selected"; } } - echo ""; + echo "\n"; echo ""; echo "{$gateway['name']} "; echo ""; - echo ""; + echo "\n"; echo ""; $selected = array(); @@ -210,15 +212,24 @@ include("head.inc"); $selected[$itemsplit[2]] = "selected"; break; } else { - $selected[0] = "selected"; + $selected['address'] = "selected"; } } echo ""; - echo "{$gateway['descr']}"; + echo ""; + echo "{$gateway['descr']}"; echo ""; } ?>