summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_rules_edit.php
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-01-26 23:59:43 +0000
committerErmal Luçi <eri@pfsense.org>2010-01-26 23:59:43 +0000
commit9b16b83439add7c4898c8911e5a36a1ed1d3bdc2 (patch)
tree77a4f23c1936b15e962ee61ff2b6aabecd8aabd9 /usr/local/www/firewall_rules_edit.php
parent8f3f7729dca3cb734bc9d06a53953a07d6fca0c1 (diff)
downloadpfsense-9b16b83439add7c4898c8911e5a36a1ed1d3bdc2.zip
pfsense-9b16b83439add7c4898c8911e5a36a1ed1d3bdc2.tar.gz
Ticket #136.
Fix associated nat rules. Now both the filter rules and the nat ones contain a associated-rule-id tag which helps link the items together. The API to use for this is in itemid.inc. All the issues should be solved now.
Diffstat (limited to 'usr/local/www/firewall_rules_edit.php')
-rwxr-xr-xusr/local/www/firewall_rules_edit.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php
index d799841..034a683 100755
--- a/usr/local/www/firewall_rules_edit.php
+++ b/usr/local/www/firewall_rules_edit.php
@@ -157,7 +157,7 @@ if (isset($id) && $a_filter[$id]) {
//schedule support
$pconfig['sched'] = $a_filter[$id]['sched'];
- $pconfig['associated-nat-rule-id'] = $a_filter[$id]['associated-nat-rule-id'];
+ $pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
} else {
/* defaults */
@@ -246,10 +246,10 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "type proto src");
- if ( isset($a_filter[$id]['associated-nat-rule-id'])===false )
+ if ( isset($a_filter[$id]['associated-rule-id'])===false )
$redqfields[] = "dst";
$reqdfieldsn = explode(",", "Type,Protocol,Source");
- if ( isset($a_filter[$id]['associated-nat-rule-id'])===false )
+ if ( isset($a_filter[$id]['associated-rule-id'])===false )
$reqdfieldsn[] = "Destination";
if($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state") {
@@ -263,7 +263,7 @@ if ($_POST) {
$reqdfields[] = "srcmask";
$reqdfieldsn[] = "Source bit count";
}
- if ( isset($a_filter[$id]['associated-nat-rule-id'])===false &&
+ if ( isset($a_filter[$id]['associated-rule-id'])===false &&
(!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single"))) ) {
$reqdfields[] = "dstmask";
$reqdfieldsn[] = "Destination bit count";
@@ -463,9 +463,9 @@ if ($_POST) {
}
// If we have an associated nat rule, make sure the destination doesn't change
- if( isset($a_filter[$id]['associated-nat-rule-id']) ) {
+ if( isset($a_filter[$id]['associated-rule-id']) ) {
$filterent['destination'] = $a_filter[$id]['destination'];
- $filterent['associated-nat-rule-id'] = $a_filter[$id]['associated-nat-rule-id'];
+ $filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
}
if (isset($id) && $a_filter[$id])
@@ -760,11 +760,19 @@ include("head.inc");
<td width="22%" valign="top" class="vncellreq">Destination</td>
<td width="78%" class="vtable">
<?php $dst_disabled=false; ?>
- <?php if( isset($pconfig['associated-nat-rule-id']) ): ?>
+ <?php if( isset($pconfig['associated-rule-id']) ): ?>
<span class="red"><strong>NOTE: </strong></span> This is associated to a NAT rule.<br />
You cannot edit the destination of associated filter rules.<br />
<br />
- <a href="firewall_nat_edit.php?id=<?=$pconfig['associated-nat-rule-id'];?>">View the NAT rule</a><br />
+ <?php
+ if (is_array($config['nat']['rule'])) {
+ foreach( $config['nat']['rule'] as $index => $nat_rule ) {
+ if( $nat_rule['assocaited-rule-id']==$pconfig['associated-rule-id'])
+ echo "<a href=\"firewall_nat_edit.php?id={$nat_rule[$index]}\">View the NAT rule</a>\n";
+ break;
+ }
+ }
+ ?>
<br />
<?php $dst_disabled=true; ?>
<script type="text/javascript">
OpenPOWER on IntegriCloud