Commit d335ebf7 authored by Franco Fichtner's avatar Franco Fichtner

gateways: allow far gateway outside of interface subnet; closes #880

(cherry picked from commit ed5c0dde)
parent facc5f45
...@@ -93,7 +93,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -93,7 +93,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} }
if (!$found) { if (!$found && !isset($pconfig['fargw'])) {
$input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within one of the chosen interface's subnets."), $pconfig['gateway']); $input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within one of the chosen interface's subnets."), $pconfig['gateway']);
} }
} }
...@@ -124,7 +124,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -124,7 +124,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} }
if (!$found) { if (!$found && !isset($pconfig['fargw'])) {
$input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within one of the chosen interface's subnets."), $pconfig['gateway']); $input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within one of the chosen interface's subnets."), $pconfig['gateway']);
} }
} }
...@@ -402,12 +402,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -402,12 +402,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$gateway[$fieldname] = $pconfig[$fieldname]; $gateway[$fieldname] = $pconfig[$fieldname];
} }
} }
if (isset($_POST['disabled'])) { if (isset($_POST['disabled'])) {
$gateway['disabled'] = true; $gateway['disabled'] = true;
} else { } elseif (isset($gateway['disabled'])) {
unset($gateway['disabled']); unset($gateway['disabled']);
} }
if (isset($_POST['fargw'])) {
$gateway['fargw'] = true;
} elseif (isset($gateway['fargw'])) {
unset($gateway['fargw']);
}
/* when saving the manual gateway we use the attribute which has the corresponding id */ /* when saving the manual gateway we use the attribute which has the corresponding id */
if (isset($realid)) { if (isset($realid)) {
$a_gateway_item[$realid] = $gateway; $a_gateway_item[$realid] = $gateway;
...@@ -459,7 +466,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -459,7 +466,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$copy_fields = array( $copy_fields = array(
'name', 'weight', 'interval', 'avg_delay_samples', 'avg_loss_samples', 'avg_loss_delay_samples', 'name', 'weight', 'interval', 'avg_delay_samples', 'avg_loss_samples', 'avg_loss_delay_samples',
'interface', 'friendlyiface', 'ipprotocol', 'gateway', 'latencylow', 'latencyhigh', 'losslow', 'losshigh', 'interface', 'friendlyiface', 'ipprotocol', 'gateway', 'latencylow', 'latencyhigh', 'losslow', 'losshigh',
'down', 'monitor', 'descr', 'avg_delay_samples_calculated', 'avg_loss_samples_calculated', 'down', 'monitor', 'descr', 'avg_delay_samples_calculated', 'avg_loss_samples_calculated', 'fargw',
'avg_loss_delay_samples_calculated', 'monitor_disable', 'dynamic', 'defaultgw', 'force_down', 'disabled' 'avg_loss_delay_samples_calculated', 'monitor_disable', 'dynamic', 'defaultgw', 'force_down', 'disabled'
); );
foreach ($copy_fields as $fieldname) { foreach ($copy_fields as $fieldname) {
...@@ -633,6 +640,15 @@ $( document ).ready(function() { ...@@ -633,6 +640,15 @@ $( document ).ready(function() {
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<td><a id="help_for_fargw" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Far Gateway"); ?></td>
<td>
<input name="fargw" type="checkbox" value="yes" <?=!empty($pconfig['fargw']) ? 'checked="checked"' : '';?> />
<div class="hidden" for="help_for_fargw">
<?=gettext("This will allow the gateway to exist outside of the interface subnet."); ?>
</div>
</td>
</tr>
<tr> <tr>
<td><a id="help_for_monitor_disable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable Gateway Monitoring"); ?></td> <td><a id="help_for_monitor_disable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Disable Gateway Monitoring"); ?></td>
<td> <td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment