summaryrefslogtreecommitdiffstats
path: root/usr/local/www/system_gateways_edit.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-11-21 09:36:50 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-11-21 09:37:02 -0200
commit23d9f68660373adc3b419af857001aa992978d17 (patch)
tree0d0d022184bcda19c3d318f7e615c0477cd2498d /usr/local/www/system_gateways_edit.php
parent33e71f1087e1885eae9393626a331147eca5c7c7 (diff)
downloadpfsense-23d9f68660373adc3b419af857001aa992978d17.zip
pfsense-23d9f68660373adc3b419af857001aa992978d17.tar.gz
Fix an issue that changes wrong gateway entry when items are hidden
Diffstat (limited to 'usr/local/www/system_gateways_edit.php')
-rwxr-xr-xusr/local/www/system_gateways_edit.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php
index 3473bb0..fb9d8d7 100755
--- a/usr/local/www/system_gateways_edit.php
+++ b/usr/local/www/system_gateways_edit.php
@@ -75,11 +75,11 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['dynamic'] = true;
$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'];
+ $pconfig['latencylow'] = $a_gateways[$id]['latencylow'];
+ $pconfig['latencyhigh'] = $a_gateways[$id]['latencyhigh'];
+ $pconfig['losslow'] = $a_gateways[$id]['losslow'];
+ $pconfig['losshigh'] = $a_gateways[$id]['losshigh'];
+ $pconfig['down'] = $a_gateways[$id]['down'];
$pconfig['monitor'] = $a_gateways[$id]['monitor'];
$pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']);
$pconfig['descr'] = $a_gateways[$id]['descr'];
@@ -91,6 +91,9 @@ if (isset($_GET['dup'])) {
unset($pconfig['attribute']);
}
+if (isset($id) && $a_gateways[$id])
+ $realid = $a_gateways[$id]['attribute'];
+
if ($_POST) {
unset($input_errors);
@@ -386,12 +389,12 @@ if ($_POST) {
$gateway['monitor_disable'] = true;
else if (is_ipaddr($_POST['monitor'])) {
/* NOTE: If monitor ip is changed need to cleanup the old static route */
- if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$id]) && is_ipaddr($a_gateway_item[$id]['monitor']) &&
- $_POST['monitor'] != $a_gateway_item[$id]['monitor'] && $gateway['gateway'] != $a_gateway_item[$id]['monitor']) {
- if (is_ipaddrv4($a_gateway_item[$id]['monitor']))
- mwexec("/sbin/route delete " . escapeshellarg($a_gateway_item[$id]['monitor']));
+ if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['monitor']) &&
+ $_POST['monitor'] != $a_gateway_item[$realid]['monitor'] && $gateway['gateway'] != $a_gateway_item[$realid]['monitor']) {
+ if (is_ipaddrv4($a_gateway_item[$realid]['monitor']))
+ mwexec("/sbin/route delete " . escapeshellarg($a_gateway_item[$realid]['monitor']));
else
- mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateway_item[$id]['monitor']));
+ mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateway_item[$realid]['monitor']));
}
$gateway['monitor'] = $_POST['monitor'];
}
@@ -422,8 +425,8 @@ if ($_POST) {
$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;
+ if (isset($realid) && $a_gateway_item[$realid])
+ $a_gateway_item[$realid] = $gateway;
else
$a_gateway_item[] = $gateway;
OpenPOWER on IntegriCloud