summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-07 17:12:05 +0000
committerErmal <eri@pfsense.org>2010-05-07 17:12:05 +0000
commit023920e7b0ef59795071167f6d504d18c3aa48ee (patch)
tree38d88cb9865e633f93fd168cb43bc84639daf304 /usr/local/www/system_gateways_edit.php
parent1b38ac365032f774a9eb0ea140d342ee4070dc62 (diff)
downloadpfsense-023920e7b0ef59795071167f6d504d18c3aa48ee.zip
pfsense-023920e7b0ef59795071167f6d504d18c3aa48ee.tar.gz
Move the settings of down/latency/loss to per gateway. This allows more fine grained control on gateways.
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-xusr/local/www/system_gateways_edit.php129
1 files changed, 117 insertions, 12 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 1209704..5c14f17 100755
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -69,6 +69,11 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['friendlyiface'] = $a_gateways[$id]['friendlyiface'];
$pconfig['gateway'] = $a_gateways[$id]['gateway'];
$pconfig['defaultgw'] = isset($a_gateways[$id]['defaultgw']);
+ $pconfig['latencylow'] = $a_gateway_item[$id]['latencylow'];
+ $pconfig['latencyhigh'] = $a_gateway_item[$id]['latencyhigh'];
+ $pconfig['losslow'] = $a_gateway_item[$id]['losslow'];
+ $pconfig['losshigh'] = $a_gateway_item[$id]['losshigh'];
+ $pconfig['down'] = $a_gateway_item[$id]['down'];
if (isset($a_gateways[$id]['dynamic']))
$pconfig['dynamic'] = true;
if($a_gateways[$id]['monitor'] <> "") {
@@ -146,6 +151,46 @@ if ($_POST) {
}
}
+ /* input validation */
+ if($_POST['latencylow']) {
+ if (! is_numeric($_POST['latencylow'])) {
+ $input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
+ }
+ }
+
+ if($_POST['latencyhigh']) {
+ if (! is_numeric($_POST['latencyhigh'])) {
+ $input_errors[] = gettext("The high latency watermark needs to be a numeric value.");
+ }
+ }
+ if($_POST['losslow']) {
+ if (! is_numeric($_POST['losslow'])) {
+ $input_errors[] = gettext("The low loss watermark needs to be a numeric value.");
+ }
+ }
+ if($_POST['losshigh']) {
+ if (! is_numeric($_POST['losshigh'])) {
+ $input_errors[] = gettext("The high loss watermark needs to be a numeric value.");
+ }
+ }
+
+ if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
+ if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
+ $input_errors[] = gettext("The High latency watermark needs to be higher then the low latency watermark");
+ }
+ }
+
+ if(($_POST['losslow']) && ($_POST['losshigh'])){
+ if($_POST['losslow'] > $_POST['losshigh']) {
+ $input_errors[] = gettext("The High packet loss watermark needs to be higher then the low packet loss watermark");
+ }
+ }
+ if($_POST['down']) {
+ if (! is_numeric($_POST['down']) || $_POST['down'] < 1) {
+ $input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
+ }
+ }
+
if (!$input_errors) {
$reloadif = false;
/* if we are processing a system gateway only save the monitorip */
@@ -194,6 +239,17 @@ if ($_POST) {
unset($gateway['defaultgw']);
}
+ if ($_POST['latencylow'])
+ $gateway['latencylow'] = $_POST['latencylow'];
+ if ($_POST['latencyhigh'])
+ $gateway['latencyhigh'] = $_POST['latencyhigh'];
+ if ($_POST['losslow'])
+ $gateway['losslow'] = $_POST['losslow'];
+ if ($_POST['losshigh'])
+ $gateway['losshigh'] = $_POST['losshigh'];
+ if ($_POST['down'])
+ $gateway['down'] = $_POST['down'];
+
/* when saving the manual gateway we use the attribute which has the corresponding id */
if (isset($id) && $a_gateway_item[$id]) {
$a_gateway_item[$id] = $gateway;
@@ -239,6 +295,11 @@ function enable_change(obj) {
}
}
+function show_advanced_gateway() {
+ document.getElementById("showadvgatewaybox").innerHTML='';
+ aodiv = document.getElementById('showgatewayadv');
+ aodiv.style.display = "block";
+}
</script>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="system_gateways_edit.php" method="post" name="iform" id="iform">
@@ -315,19 +376,63 @@ function enable_change(obj) {
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Weight");?></td>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Advanced");?></td>
<td width="78%" class="vtable">
- <select name='weight' class='formfldselect' id='weight'>
- <?php
- for ($i = 1; $i < 6; $i++) {
- $selected = "";
- if ($pconfig['weight'] == $i)
- $selected = "selected";
- echo "<option value='{$i}' {$selected} >{$i}</option>";
- }
- ?>
- </select>
- <strong><?=gettext("Weight for this gateway when used in a Gateway Group.");?></strong> <br />
+ <div id="showadvgatewaybox" <? if (!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1)) echo "style='display:none'"; ?>>
+ <input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a>
+ </div>
+ <div id="showgatewayadv" <? if (empty($pconfig['latencylow']) && empty($pconfig['latencyhigh']) && empty($pconfig['losslow']) && empty($pconfig['losshigh']) && (empty($pconfig['weight']) || $pconfig['weight'] == 1)) echo "style='display:none'"; ?>>
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td>
+ <td width="78%" class="vtable">
+ <select name='weight' class='formfldselect' id='weight'>
+ <?php
+ for ($i = 1; $i < 6; $i++) {
+ $selected = "";
+ if ($pconfig['weight'] == $i)
+ $selected = "selected";
+ echo "<option value='{$i}' {$selected} >{$i}</option>";
+ }
+ ?>
+ </select>
+ <br /><?=gettext("Weight for this gateway when used in a Gateway Group.");?> <br />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td>
+ <td width="78%" class="vtable">
+ <?=gettext("From");?>
+ <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2"
+ value="<?=htmlspecialchars($pconfig['latencylow']);?>">
+ <?=gettext("To");?>
+ <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2"
+ value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
+ <br> <span class="vexpl"><?=gettext("These define the low and high water marks for latency in milliseconds.");?></span></td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td>
+ <td width="78%" class="vtable">
+ <?=gettext("From");?>
+ <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2"
+ value="<?=htmlspecialchars($pconfig['losslow']);?>">
+ <?=gettext("To");?>
+ <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2"
+ value="<?=htmlspecialchars($pconfig['losshigh']);?>">
+ <br> <span class="vexpl"><?=gettext("These define the low and high water marks for packet loss in %.");?></span></td>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Down");?></td>
+ <td width="78%" class="vtable">
+ <input name="down" type="text" class="formfld unknown" id="down" size="2"
+ value="<?=htmlspecialchars($pconfig['down']);?>">
+ <br> <span class="vexpl"><?=gettext("This defines the down time for the alarm to fire, in seconds.");?></span></td>
+ </td>
+ </tr>
+ </table>
+ </div>
</td>
</tr>
<tr>
OpenPOWER on IntegriCloud