summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/firewall_virtual_ip_edit.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-14 23:18:15 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-14 23:18:15 +0545
commit67c2baf157c50ae1b545f36bcf6afee6cdf6f67c (patch)
treec429615f87c26b3da9c58c7149d827a893461dbe /src/usr/local/www/firewall_virtual_ip_edit.php
parent935b578b7606b8af6866c3c01e9e7b7f9c58a0d9 (diff)
downloadpfsense-67c2baf157c50ae1b545f36bcf6afee6cdf6f67c.zip
pfsense-67c2baf157c50ae1b545f36bcf6afee6cdf6f67c.tar.gz
Coe style firewall *
Diffstat (limited to 'src/usr/local/www/firewall_virtual_ip_edit.php')
-rw-r--r--src/usr/local/www/firewall_virtual_ip_edit.php50
1 files changed, 27 insertions, 23 deletions
diff --git a/src/usr/local/www/firewall_virtual_ip_edit.php b/src/usr/local/www/firewall_virtual_ip_edit.php
index ebdccc4..9d30ce7 100644
--- a/src/usr/local/www/firewall_virtual_ip_edit.php
+++ b/src/usr/local/www/firewall_virtual_ip_edit.php
@@ -202,19 +202,22 @@ if ($_POST) {
case 'carp':
/* verify against reusage of vhids */
$idtracker = 0;
- foreach($config['virtualip']['vip'] as $vip) {
- if($vip['vhid'] == $_POST['vhid'] && $vip['interface'] == $_POST['interface'] && $idtracker != $id)
- $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."),$_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
+ foreach ($config['virtualip']['vip'] as $vip) {
+ if ($vip['vhid'] == $_POST['vhid'] && $vip['interface'] == $_POST['interface'] && $idtracker != $id) {
+ $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."), $_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
+ }
$idtracker++;
}
- if (empty($_POST['password']))
+ if (empty($_POST['password'])) {
$input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members.");
+ }
- if ($_POST['interface'] == 'lo0')
+ if ($_POST['interface'] == 'lo0') {
$input_errors[] = gettext("For this type of vip localhost is not allowed.");
- else if (strpos($_POST['interface'], '_vip'))
+ } else if (strpos($_POST['interface'], '_vip')) {
$input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
+ }
break;
case 'ipalias':
@@ -230,9 +233,9 @@ if ($_POST) {
}
if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") &&
- !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
+ !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
$cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ;
- $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find);
+ $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."), $cannot_find);
}
unset($parent_ip, $parent_sn, $subnet);
@@ -240,10 +243,11 @@ if ($_POST) {
break;
default:
- if ($_POST['interface'] == 'lo0')
+ if ($_POST['interface'] == 'lo0') {
$input_errors[] = gettext("For this type of vip localhost is not allowed.");
- else if (strpos($_POST['interface'], '_vip'))
+ } else if (strpos($_POST['interface'], '_vip')) {
$input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
+ }
break;
}
@@ -327,7 +331,7 @@ if ($_POST) {
$ipaliashelp = gettext('The mask must be the network\'s subnet mask. It does not specify a CIDR range.');
$proxyarphelp = gettext('Enter a CIDR block of proxy ARP addresses.');
-$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Address"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Address"), gettext("Edit"));
include("head.inc");
function build_if_list() {
@@ -336,16 +340,18 @@ function build_if_list() {
$interfaces = get_configured_interface_with_descr(false, true);
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip . ' (' . get_vip_descr($carpip) . ')';
+ }
$interfaces['lo0'] = 'Localhost';
return($interfaces);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form();
@@ -485,14 +491,15 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden
function hideCheckbox(id, hide) {
- if(hide)
+ if (hide) {
$('#' + id).parent().parent().parent('div').addClass('hidden');
- else
+ } else {
$('#' + id).parent().parent().parent('div').removeClass('hidden');
+ }
}
// Disables the specified input element
@@ -512,13 +519,12 @@ events.push(function(){
disableInput('password', true);
hideCheckbox('noexpand', true);
- if(mode == 'ipalias') {
+ if (mode == 'ipalias') {
$('#address_note').html("<?=$ipaliashelp?>");
$('#type').val('single');
disableInput('subnet_bits', false);
- }
- else if(mode == 'carp') {
+ } else if (mode == 'carp') {
$('#address_note').html("<?=$ipaliashelp?>");
disableInput('vhid', false);
disableInput('advbase', false);
@@ -526,13 +532,11 @@ events.push(function(){
disableInput('password', false);
disableInput('subnet_bits', false);
$('#type').val('single');
- }
- else if(mode == 'proxyarp') {
+ } else if (mode == 'proxyarp') {
$('#address_note').html("<?=$proxyarphelp?>");
disableInput('type', false);
disableInput('subnet_bits', ($('#type').val() == 'single'));
- }
- else {
+ } else {
$('#address_note').html('');
disableInput('type', false);
disableInput('subnet_bits', ($('#type').val() == 'single'));
OpenPOWER on IntegriCloud