Add NAT rule based on NAT rule below it instead of at the bottom of the list. Fixes #1118

This commit is contained in:
Renato Botelho 2013-02-21 16:15:07 -03:00
parent 95540233e3
commit 3202763c8b
2 changed files with 13 additions and 12 deletions

View File

@ -60,6 +60,11 @@ $id = $_GET['id'];
if (isset($_POST['id']))
$id = $_POST['id'];
$after = $_GET['after'];
if (isset($_POST['after']))
$after = $_POST['after'];
if (isset($_GET['dup'])) {
$id = $_GET['dup'];
$after = $_GET['dup'];
@ -365,16 +370,6 @@ if ($_POST) {
$_POST['filter-rule-association']=='add-unassociated') )
$need_filter_rule = true;
// Determine NAT entry ID now, we need it for the firewall rule
if (isset($id) && $a_nat[$id])
$a_nat[$id] = $natent;
else {
if (is_numeric($after))
$id = $after + 1;
else
$id = count($a_nat);
}
if ($need_filter_rule == true) {
/* auto-generate a matching firewall rule */
@ -855,6 +850,7 @@ include("fbegin.inc"); ?>
<?php if (isset($id) && $a_nat[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<?php endif; ?>
<input name="after" type="hidden" value="<?=htmlspecialchars($after);?>">
</td>
</tr>
</table>

View File

@ -63,11 +63,15 @@ if (isset($_POST['id'])) {
$id = $_POST['id'];
}
$after = $_GET['after'];
if (isset($_POST['after']))
$after = $_POST['after'];
if (isset($_GET['dup'])) {
$id = $_GET['dup'];
$after = $_GET['dup'];
} else
unset($after);
}
if (isset($id) && $a_out[$id]) {
$pconfig['protocol'] = $a_out[$id]['protocol'];
@ -661,6 +665,7 @@ any)");?></td>
<?php if (isset($id) && $a_out[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<?php endif; ?>
<input name="after" type="hidden" value="<?=htmlspecialchars($after);?>">
</td>
</tr>
</table>