Project

General

Profile

Download (6.64 KB) Statistics
| Branch: | Tag: | Revision:
1 19ae0929 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	firewall_nat_1to1.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6 19ae0929 Scott Ullrich
7 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9 19ae0929 Scott Ullrich
10 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 19ae0929 Scott Ullrich
13 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 19ae0929 Scott Ullrich
16 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19 19ae0929 Scott Ullrich
20 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-firewall-nat-1-1
34
##|*NAME=Firewall: NAT: 1:1 page
35
##|*DESCR=Allow access to the 'Firewall: NAT: 1:1' page.
36
##|*MATCH=firewall_nat_1to1.php*
37
##|-PRIV
38
39
40 5b237745 Scott Ullrich
require("guiconfig.inc");
41
42
if (!is_array($config['nat']['onetoone'])) {
43
	$config['nat']['onetoone'] = array();
44
}
45
$a_1to1 = &$config['nat']['onetoone'];
46
nat_1to1_rules_sort();
47
48
if ($_POST) {
49
50
	$pconfig = $_POST;
51
52
	if ($_POST['apply']) {
53
		$retval = 0;
54 920b3bb0 Scott Ullrich
55
		config_lock();
56
		$retval |= filter_configure();
57
		config_unlock();
58
59 5b237745 Scott Ullrich
		$savemsg = get_std_save_message($retval);
60 19ae0929 Scott Ullrich
61 5b237745 Scott Ullrich
		if ($retval == 0) {
62
			if (file_exists($d_natconfdirty_path))
63
				unlink($d_natconfdirty_path);
64
			if (file_exists($d_filterconfdirty_path))
65
				unlink($d_filterconfdirty_path);
66
		}
67
	}
68
}
69
70
if ($_GET['act'] == "del") {
71
	if ($a_1to1[$_GET['id']]) {
72
		unset($a_1to1[$_GET['id']]);
73
		write_config();
74
		touch($d_natconfdirty_path);
75
		header("Location: firewall_nat_1to1.php");
76
		exit;
77
	}
78
}
79 6eb17647 Scott Ullrich
80 d88c6a9f Scott Ullrich
$pgtitle = array("Firewall","NAT","1:1");
81 6eb17647 Scott Ullrich
include("head.inc");
82
83 24f600b0 Scott Ullrich
?>
84 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
85
<?php include("fbegin.inc"); ?>
86
<form action="firewall_nat_1to1.php" method="post">
87
<?php if ($savemsg) print_info_box($savemsg); ?>
88
<?php if (file_exists($d_natconfdirty_path)): ?><p>
89
<?php print_info_box_np("The NAT configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
90
<?php endif; ?>
91
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
92 a8726a3d Scott Ullrich
<?php
93
	$tab_array = array();
94 1425e067 Bill Marquette
	$tab_array[] = array("Port Forward", false, "firewall_nat.php");
95
	$tab_array[] = array("1:1", true, "firewall_nat_1to1.php");
96
	$tab_array[] = array("Outbound", false, "firewall_nat_out.php");
97 a8726a3d Scott Ullrich
	display_top_tabs($tab_array);
98
?>
99 5b237745 Scott Ullrich
  </td></tr>
100 19ae0929 Scott Ullrich
  <tr>
101 d732f186 Bill Marquette
    <td>
102
	<div id="mainarea">
103
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
104 19ae0929 Scott Ullrich
                <tr>
105 d970cc7c Bill Marquette
		  <td width="10%" class="listhdrr">Interface</td>
106 5b237745 Scott Ullrich
                  <td width="20%" class="listhdrr">External IP</td>
107
                  <td width="20%" class="listhdrr">Internal IP</td>
108
                  <td width="40%" class="listhdr">Description</td>
109 d415d821 Seth Mos
                  <td width="10%" class="list">
110
                    <table border="0" cellspacing="0" cellpadding="1">
111
                      <tr>
112
			<td width="17"></td>
113
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add rule"></a></td>
114
                      </tr>
115
                    </table>
116
		  </td>
117 5b237745 Scott Ullrich
				</tr>
118
			  <?php $i = 0; foreach ($a_1to1 as $natent): ?>
119 19ae0929 Scott Ullrich
                <tr>
120 d970cc7c Bill Marquette
		  <td class="listlr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
121 5b237745 Scott Ullrich
                  <?php
122
					if (!$natent['interface'] || ($natent['interface'] == "wan"))
123
						echo "WAN";
124
					else
125
						echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']);
126
				  ?>
127
                  </td>
128 d970cc7c Bill Marquette
                  <td class="listr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
129 5b237745 Scott Ullrich
                    <?php echo $natent['external'];
130
					if ($natent['subnet']) echo "/" . $natent['subnet']; ?>
131
                  </td>
132 d970cc7c Bill Marquette
                  <td class="listr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
133 5b237745 Scott Ullrich
                    <?php echo $natent['internal'];
134
					if ($natent['subnet']) echo "/" . $natent['subnet']; ?>
135
                  </td>
136 d970cc7c Bill Marquette
                  <td class="listbg" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
137 19ae0929 Scott Ullrich
                    <font color="#ffffff"><?=htmlspecialchars($natent['descr']);?>&nbsp;
138 5b237745 Scott Ullrich
                  </td>
139 48d751fd Bill Marquette
                  <td class="list" nowrap>
140
                    <table border="0" cellspacing="0" cellpadding="1">
141
                      <tr>
142 f057bae4 Bill Marquette
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit rule"></a></td>
143
                        <td valign="middle"><a href="firewall_nat_1to1.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete rule"></a></td>
144 48d751fd Bill Marquette
                      </tr>
145
                    </table>
146
                  </td>
147
                </tr>
148
		<?php $i++; endforeach; ?>
149 19ae0929 Scott Ullrich
                <tr>
150 5b237745 Scott Ullrich
                  <td class="list" colspan="4"></td>
151 48d751fd Bill Marquette
                  <td class="list">
152
                    <table border="0" cellspacing="0" cellpadding="1">
153
                      <tr>
154 d415d821 Seth Mos
			<td width="17"></td>
155 f057bae4 Bill Marquette
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add rule"></a></td>
156 48d751fd Bill Marquette
                      </tr>
157
                    </table>
158
                  </td>
159
                </tr>
160 d732f186 Bill Marquette
		<tr>
161
		  <td colspan="4">
162
		        <p><span class="vexpl"><span class="red"><strong>Note:<br>
163 1425e067 Bill Marquette
                      </strong></span>Depending on the way your WAN connection is setup, you may also need a <a href="firewall_virtual_ip.php">Virtual IP</a>.</span></p>
164 d732f186 Bill Marquette
		  </td>
165
		<tr>
166
              </table>
167
	    </div>
168
	</td>
169 5b237745 Scott Ullrich
</tr>
170
</table>
171
</form>
172
<?php include("fend.inc"); ?>
173
</body>
174
</html>