mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
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
This commit is contained in:
parent
27a7980237
commit
ab1112da4c
@ -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;
|
||||
}
|
||||
|
||||
@ -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 "<tr>";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='listlr'>";
|
||||
echo "<strong>{$gateway['name']} </strong>";
|
||||
echo "</td><td class='listr'>";
|
||||
echo "<select name='{$gwname}' class='formfldselect' id='{$gwname}'>";
|
||||
echo "<option value='0' $selected[0] >" . gettext("Never") . "</option>";
|
||||
echo "<option value='1' $selected[1] >" . gettext("Tier 1") . "</option>";
|
||||
echo "<option value='2' $selected[2] >" . gettext("Tier 2") . "</option>";
|
||||
echo "<option value='3' $selected[3] >" . gettext("Tier 3") . "</option>";
|
||||
echo "<option value='4' $selected[4] >" . gettext("Tier 4") . "</option>";
|
||||
echo "<option value='5' $selected[5] >" . gettext("Tier 5") . "</option>";
|
||||
echo "</select>";
|
||||
echo "<select name='{$gwname}' class='formfldselect' id='{$gwname}'>\n";
|
||||
echo "<option value='0' $selected[0] >" . gettext("Never") . "</option>\n";
|
||||
echo "<option value='1' $selected[1] >" . gettext("Tier 1") . "</option>\n";
|
||||
echo "<option value='2' $selected[2] >" . gettext("Tier 2") . "</option>\n";
|
||||
echo "<option value='3' $selected[3] >" . gettext("Tier 3") . "</option>\n";
|
||||
echo "<option value='4' $selected[4] >" . gettext("Tier 4") . "</option>\n";
|
||||
echo "<option value='5' $selected[5] >" . gettext("Tier 5") . "</option>\n";
|
||||
echo "</select>\n";
|
||||
echo "</td>";
|
||||
|
||||
$selected = array();
|
||||
@ -210,15 +212,24 @@ include("head.inc");
|
||||
$selected[$itemsplit[2]] = "selected";
|
||||
break;
|
||||
} else {
|
||||
$selected[0] = "selected";
|
||||
$selected['address'] = "selected";
|
||||
}
|
||||
}
|
||||
echo "<td class='listr'>";
|
||||
echo "<select name='{$gwname}_vip' class='formfldselect' id='{$gwname}_vip'>";
|
||||
echo "<option value='address' $selected[0] >" . gettext("Interface Address") . "</option>";
|
||||
// foreach($vips)
|
||||
echo "</td><td class='listr'>";
|
||||
echo "</select><strong>{$gateway['descr']}</strong>";
|
||||
echo "<select name='{$gwname}_vip' class='formfldselect' id='{$gwname}_vip'>\n";
|
||||
echo "<option value='address' {$selected['address']} >" . gettext("Interface Address") . "</option>\n";
|
||||
foreach($carplist as $vip => $address) {
|
||||
echo "<!-- $vip - $address - $interface -->\n";
|
||||
if(!preg_match("/^{$interface}_/i", $vip))
|
||||
continue;
|
||||
if(($gateway['ipprotocol'] == "inet") && (!is_ipaddrv4($address)))
|
||||
continue;
|
||||
if(($gateway['ipprotocol'] == "inet6") && (!is_ipaddrv6($address)))
|
||||
continue;
|
||||
echo "<option value='{$vip}' $selected[$vip] >$vip - $address</option>\n";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<td class='listr'><strong>{$gateway['descr']}</strong>";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user