summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_nat_out_edit.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2004-11-19 23:12:26 +0000
committerScott Ullrich <sullrich@pfsense.org>2004-11-19 23:12:26 +0000
commitcfc707f76372f4411961b97c2afc9174825b2216 (patch)
tree2df2b6ad86de2c9bc321ac6c2b323ac8dfcfa7b4 /usr/local/www/firewall_nat_out_edit.php
parent1b2808f1f8cd7d45befa4209c677ebe56d294432 (diff)
downloadpfsense-cfc707f76372f4411961b97c2afc9174825b2216.zip
pfsense-cfc707f76372f4411961b97c2afc9174825b2216.tar.gz
Add Copyright to each file that we have touched so far and re attribute the file to Manuel Kasper such as:
Copyright (C) 2004 Scott Ullrich All rights reserved. originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved.
Diffstat (limited to 'usr/local/www/firewall_nat_out_edit.php')
-rwxr-xr-xusr/local/www/firewall_nat_out_edit.php88
1 files changed, 45 insertions, 43 deletions
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php
index 723de78..0d4c991 100755
--- a/usr/local/www/firewall_nat_out_edit.php
+++ b/usr/local/www/firewall_nat_out_edit.php
@@ -1,22 +1,24 @@
#!/usr/local/bin/php
-<?php
+<?php
/*
firewall_nat_out_edit.php
- part of m0n0wall (http://m0n0.ch/wall)
-
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
+
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-
+
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
-
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@@ -33,7 +35,7 @@ require("guiconfig.inc");
if (!is_array($config['nat']['advancedoutbound']['rule']))
$config['nat']['advancedoutbound']['rule'] = array();
-
+
$a_out = &$config['nat']['advancedoutbound']['rule'];
nat_out_rules_sort();
@@ -74,19 +76,19 @@ if (isset($id) && $a_out[$id]) {
}
if ($_POST) {
-
+
if ($_POST['destination_type'] == "any") {
$_POST['destination'] = "any";
$_POST['destination_subnet'] = 24;
}
-
+
unset($input_errors);
$pconfig = $_POST;
/* input validation */
$reqdfields = explode(" ", "interface source source_subnet destination destination_subnet");
$reqdfieldsn = explode(",", "Interface,Source,Source bit count,Destination,Destination bit count");
-
+
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
if ($_POST['source'] && !is_ipaddr($_POST['source'])) {
@@ -106,7 +108,7 @@ if ($_POST) {
if ($_POST['target'] && !is_ipaddr($_POST['target'])) {
$input_errors[] = "A valid target IP address must be specified.";
}
-
+
/* check for existing entries */
$osn = gen_subnet($_POST['source'], $_POST['source_subnet']) . "/" . $_POST['source_subnet'];
if ($_POST['destination_type'] == "any")
@@ -114,7 +116,7 @@ if ($_POST) {
else
$ext = gen_subnet($_POST['destination'], $_POST['destination_subnet']) . "/"
. $_POST['destination_subnet'];
-
+
if ($_POST['target']) {
/* check for clashes with 1:1 NAT (Server NAT is OK) */
if (is_array($config['nat']['onetoone'])) {
@@ -126,14 +128,14 @@ if ($_POST) {
}
}
}
-
+
foreach ($a_out as $natent) {
if (isset($id) && ($a_out[$id]) && ($a_out[$id] === $natent))
continue;
-
+
if (!$natent['interface'])
$natent['interface'] == "wan";
-
+
if (($natent['interface'] == $_POST['interface']) && ($natent['source']['network'] == $osn)) {
if (isset($natent['destination']['not']) == isset($_POST['destination_not'])) {
if ((isset($natent['destination']['any']) && ($ext == "any")) ||
@@ -151,24 +153,24 @@ if ($_POST) {
$natent['descr'] = $_POST['descr'];
$natent['target'] = $_POST['target'];
$natent['interface'] = $_POST['interface'];
-
+
if ($ext == "any")
$natent['destination']['any'] = true;
else
$natent['destination']['network'] = $ext;
-
+
if (isset($_POST['destination_not']) && $ext != "any")
$natent['destination']['not'] = true;
-
+
if (isset($id) && $a_out[$id])
$a_out[$id] = $natent;
else
$a_out[] = $natent;
-
+
touch($d_natconfdirty_path);
-
+
write_config();
-
+
header("Location: firewall_nat_out.php");
exit;
}
@@ -216,7 +218,7 @@ function typesel_change() {
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
}
foreach ($interfaces as $iface => $ifacename): ?>
- <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
+ <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php endforeach; ?>
@@ -224,12 +226,12 @@ function typesel_change() {
<span class="vexpl">Choose which interface this rule applies to.<br>
Hint: in most cases, you'll want to use WAN here.</span></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Source</td>
<td width="78%" class="vtable">
<input name="source" type="text" class="formfld" id="source" size="20" value="<?=htmlspecialchars($pconfig['source']);?>">
-
- /
+
+ /
<select name="source_subnet" class="formfld" id="source_subnet">
<?php for ($i = 32; $i >= 0; $i--): ?>
<option value="<?=$i;?>" <?php if ($i == $pconfig['source_subnet']) echo "selected"; ?>>
@@ -240,7 +242,7 @@ function typesel_change() {
<br>
<span class="vexpl">Enter the source network for the outbound NAT mapping.</span></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncellreq">Destination</td>
<td width="78%" class="vtable">
<input name="destination_not" type="checkbox" id="destination_not" value="yes" <?php if ($pconfig['destination_not']) echo "checked"; ?>>
@@ -248,22 +250,22 @@ function typesel_change() {
Use this option to invert the sense of the match.<br>
<br>
<table border="0" cellspacing="0" cellpadding="0">
- <tr>
+ <tr>
<td>Type:&nbsp;&nbsp;</td>
<td><select name="destination_type" class="formfld" onChange="typesel_change()">
- <option value="any" <?php if ($pconfig['destination'] == "any") echo "selected"; ?>>
+ <option value="any" <?php if ($pconfig['destination'] == "any") echo "selected"; ?>>
any</option>
- <option value="network" <?php if ($pconfig['destination'] != "any") echo "selected"; ?>>
+ <option value="network" <?php if ($pconfig['destination'] != "any") echo "selected"; ?>>
Network</option>
</select></td>
</tr>
- <tr>
+ <tr>
<td>Address:&nbsp;&nbsp;</td>
<td><input name="destination" type="text" class="formfld" id="destination" size="20" value="<?=htmlspecialchars($pconfig['destination']);?>">
- /
+ /
<select name="destination_subnet" class="formfld" id="destination_subnet">
<?php for ($i = 32; $i >= 0; $i--): ?>
- <option value="<?=$i;?>" <?php if ($i == $pconfig['destination_subnet']) echo "selected"; ?>>
+ <option value="<?=$i;?>" <?php if ($i == $pconfig['destination_subnet']) echo "selected"; ?>>
<?=$i;?>
</option>
<?php endfor; ?>
@@ -271,31 +273,31 @@ function typesel_change() {
</tr>
<tr>
<td>&nbsp;</td>
- <td><span class="vexpl">Enter the destination network for
+ <td><span class="vexpl">Enter the destination network for
the outbound NAT mapping.</span></td>
</tr>
</table></td>
</tr>
- <tr>
+ <tr>
<td valign="top" class="vncell">Target</td>
<td class="vtable">
<input name="target" type="text" class="formfld" id="target" size="20" value="<?=htmlspecialchars($pconfig['target']);?>">
<br>
<span class="vexpl">Packets matching this rule will be mapped to the IP address given here. Leave blank to use the selected interface's IP address.</span></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell">Description</td>
- <td width="78%" class="vtable">
- <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
- <br> <span class="vexpl">You may enter a description here
+ <td width="78%" class="vtable">
+ <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
+ <br> <span class="vexpl">You may enter a description here
for your reference (not parsed).</span></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="Save">
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save">
<?php if (isset($id) && $a_out[$id]): ?>
- <input name="id" type="hidden" value="<?=$id;?>">
+ <input name="id" type="hidden" value="<?=$id;?>">
<?php endif; ?>
</td>
</tr>
OpenPOWER on IntegriCloud