summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/system_gateway_groups_edit.php
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-02-08 19:22:40 -0600
committerLuiz Otavio O Souza <luiz@netgate.com>2016-02-09 15:58:43 -0600
commit2a5960b07bb2a40aeaf81423b0c52d5629e87e49 (patch)
tree9fcb0bdd705cd77b0e570ec84a4ead17259659ac /src/usr/local/www/system_gateway_groups_edit.php
parentfd4dbabc09ddd265f78db8140bdac688651f3575 (diff)
downloadpfsense-2a5960b07bb2a40aeaf81423b0c52d5629e87e49.zip
pfsense-2a5960b07bb2a40aeaf81423b0c52d5629e87e49.tar.gz
Review of CARP uniqid changes.
It turns out that current CARP implementation is not much different from an IP alias. This commit converts the IP alias to also use the CARP uniqid scheme, this simplify the code in all other places because now we have only two different cases to deal with: - A friendly interface name (lan, wan, opt1, etc.); - A Virtual IP - VIP alias (_vip{$uniqid}) - CARP or IP Alias. The parent of a CARP is always a friendly interface. The parent of an IP alias can be a friendly interface or a CARP (this is the only case of recursion of a VIP). This commit removes a few cases where CARP were still considered a interface (the old CARP implementation), fixes all the wrong cases of strpos() being used to detect a VIP address (wont work as it returns '0' which fails when tested as 'TRUE'), review the usage of CARP and IP alias as services bind addresses, fixes general issues of adding and editing VIP addresses. The following subsystems were affected by this changes: - IPSEC; - OpenVPN; - dnsmasq; - NTP; - gateways and gateway groups; - IPv6 RA; - GRE interfaces; - CARP status; - Referrer authentication. Fixes (and/or revisit) the following tickets: - Ticket #3257 - Ticket #3716 - Ticket #4450 - Ticket #4858 - Ticket #5441 - Ticket #5442 - Ticket #5500 - Ticket #5783 - Ticket #5844
Diffstat (limited to 'src/usr/local/www/system_gateway_groups_edit.php')
-rw-r--r--src/usr/local/www/system_gateway_groups_edit.php66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php
index e875ffa..c083794 100644
--- a/src/usr/local/www/system_gateway_groups_edit.php
+++ b/src/usr/local/www/system_gateway_groups_edit.php
@@ -189,21 +189,15 @@ function build_gateway_protocol_map (&$a_gateways) {
return $result;
}
-function build_carp_list() {
- global $carplist, $gateway;
+function build_vip_list($family = 'all') {
$list = array('address' => gettext('Interface Address'));
- foreach ($carplist as $vip => $address) {
- if (($gateway['ipprotocol'] == "inet") && (!is_ipaddrv4($address))) {
- continue;
- }
- if (($gateway['ipprotocol'] == "inet6") && (!is_ipaddrv6($address))) {
- continue;
- }
- if ($gateway['friendlyiface'] == link_carp_interface_to_parent($vip)) {
- $list[$vip] = "$address";
- }
+ $viplist = get_configured_vip_list($family);
+ foreach ($viplist as $vip => $address) {
+ $list[$vip] = "$address";
+ if (get_vip_descr($address))
+ $list[$vip] .= " (". get_vip_descr($address) .")";
}
return($list);
@@ -231,11 +225,16 @@ $section->addInput(new Form_Input(
$pconfig['name']
));
-
-$carplist = get_configured_carp_interface_list();
$row = 0;
$numrows = count($a_gateways) - 1;
+$group = new Form_Group('Gateway Priority');
+$group->add(new Form_StaticText('', ''))->setReadonly();
+$group->add(new Form_StaticText('', ''))->setReadonly();
+$group->add(new Form_StaticText('', ''))->setReadonly();
+$group->add(new Form_StaticText('', ''))->setWidth(3)->setReadonly();
+$section->add($group);
+
foreach ($a_gateways as $gwname => $gateway) {
if (!empty($pconfig['item'])) {
$af = explode("|", $pconfig['item'][0]);
@@ -246,17 +245,19 @@ foreach ($a_gateways as $gwname => $gateway) {
}
}
+ $selected = '0';
+ $vaddress = '';
foreach ((array)$pconfig['item'] as $item) {
$itemsplit = explode("|", $item);
if ($itemsplit[0] == $gwname) {
$selected = $itemsplit[1];
+ if (count($itemsplit) >= 3)
+ $vaddress = $itemsplit[2];
break;
- } else {
- $selected = '0';
}
}
- $group = new Form_Group($row == 0 ? 'Gateway Priority':null);
+ $group = new Form_Group(null);
$group->addClass($gateway['ipprotocol']);
$group->add(new Form_Input(
@@ -264,8 +265,7 @@ foreach ($a_gateways as $gwname => $gateway) {
'Group Name',
'text',
$gateway['name']
- ))->setHelp($row == $numrows ? 'Gateway':null)
- ->setReadonly();
+ ))->setReadonly();
$tr = gettext("Tier");
$group->add(new Form_Select(
@@ -280,38 +280,34 @@ foreach ($a_gateways as $gwname => $gateway) {
'4' => $tr . ' 4',
'5' => $tr . ' 5'
)
- ))->setHelp($row == $numrows ? 'Tier':null)->addClass('row')->addClass($gateway['ipprotocol']);
-
- foreach ((array)$pconfig['item'] as $item) {
- $itemsplit = explode("|", $item);
- if ($itemsplit[0] == $gwname) {
- $selected = $itemsplit[2];
- break;
- } else {
- $selected = "0";
- }
- }
+ ))->addClass('row')->addClass($gateway['ipprotocol']);
$group->add(new Form_Select(
$gwname . '_vip',
'Virtual IP',
- $selected,
- build_carp_list()
- ))->setHelp($row == $numrows ? 'Virtual IP':null);
+ $vaddress,
+ build_vip_list($gateway['ipprotocol'])
+ ));
$group->add(new Form_Input(
'description',
'Group Name',
'text',
$gateway['descr']
- ))->setWidth(3)->setHelp($row == $numrows ? 'Description':null)
- ->setReadonly();
+ ))->setWidth(3)->setReadonly();
$section->add($group);
$row++;
} // e-o-foreach
+$group = new Form_Group(null);
+$group->add(new Form_StaticText('', ''))->setHelp('Gateway')->setReadonly();
+$group->add(new Form_StaticText('', ''))->setHelp('Tier')->setReadonly();
+$group->add(new Form_StaticText('', ''))->setHelp('Virtual IP')->setReadonly();
+$group->add(new Form_StaticText('', ''))->setWidth(3)->setHelp('Description')->setReadonly();
+$section->add($group);
+
$section->addInput(new Form_StaticText(
'Link Priority',
'The priority selected here defines in what order failover and balancing of links will be done. ' .
OpenPOWER on IntegriCloud