Project

General

Profile

Download (7.21 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_nat_npt.php
5
	part of pfSense (https://www.pfsense.org)
6

    
7
	Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>.
8
	All rights reserved.
9

    
10
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34
/*
35
	pfSense_MODULE:	nat
36
*/
37

    
38
##|+PRIV
39
##|*IDENT=page-firewall-nat-npt
40
##|*NAME=Firewall: NAT: NPT page
41
##|*DESCR=Allow access to the 'Firewall: NAT: NPT' page.
42
##|*MATCH=firewall_nat_npt.php*
43
##|-PRIV
44

    
45
require("guiconfig.inc");
46
require_once("functions.inc");
47
require_once("filter.inc");
48
require_once("shaper.inc");
49

    
50
if (!is_array($config['nat']['npt'])) {
51
	$config['nat']['npt'] = array();
52
}
53
$a_npt = &$config['nat']['npt'];
54

    
55
if ($_POST) {
56

    
57
	$pconfig = $_POST;
58

    
59
	if ($_POST['apply']) {
60
		$retval = 0;
61
		$retval |= filter_configure();
62
		$savemsg = get_std_save_message($retval);
63

    
64
		if ($retval == 0) {
65
			clear_subsystem_dirty('natconf');
66
			clear_subsystem_dirty('filter');
67
		}
68
	}
69
}
70

    
71
if ($_GET['act'] == "del") {
72
	if ($a_npt[$_GET['id']]) {
73
		unset($a_npt[$_GET['id']]);
74
		if (write_config())
75
			mark_subsystem_dirty('natconf');
76
		header("Location: firewall_nat_npt.php");
77
		exit;
78
	}
79
}
80

    
81
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("NPt"));
82
include("head.inc");
83

    
84
?>
85
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
86
<?php include("fbegin.inc"); ?>
87
<form action="firewall_nat_npt.php" method="post">
88
<?php if ($savemsg) print_info_box($savemsg); ?>
89
<?php if (is_subsystem_dirty('natconf')): ?>
90
<?php print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
91
<?php endif; ?>
92
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall nat npt">  <tr><td>
93
<?php
94
	$tab_array = array();
95
	$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
96
	$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
97
	$tab_array[] = array(gettext("Outbound"), false, "firewall_nat_out.php");
98
	$tab_array[] = array(gettext("NPt"), true, "firewall_nat_npt.php");
99
	display_top_tabs($tab_array);
100
?>
101
  </td></tr>
102
  <tr>
103
    <td>
104
	<div id="mainarea">
105
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
106
                <tr>
107
		  <td width="10%" class="listhdrr"><?=gettext("Interface"); ?></td>
108
                  <td width="20%" class="listhdrr"><?=gettext("External Prefix"); ?></td>
109
                  <td width="15%" class="listhdrr"><?=gettext("Internal prefix"); ?></td>
110
                  <td width="30%" class="listhdr"><?=gettext("Description"); ?></td>
111
                  <td width="10%" class="list">
112
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
113
                      <tr>
114
			<td width="17"></td>
115
                        <td valign="middle"><a href="firewall_nat_npt_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add rule"); ?>" alt="add" /></a></td>
116
                      </tr>
117
                    </table>
118
		  </td>
119
				</tr>
120
	  <?php 
121
			$textse = "</span>";
122

    
123
			$i = 0; foreach ($a_npt as $natent):
124

    
125
			if (isset($natent['disabled']))
126
				$textss = "<span class=\"gray\">";
127
			else
128
				$textss = "<span>"; ?>
129
                <tr>
130
		  <td class="listlr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
131
                  <?php
132
			echo $textss;
133
					if (!$natent['interface'])
134
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
135
					else
136
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
137
			echo $textse;
138
				  ?>
139
                  </td>
140
                    <?php 
141
			$source_net = pprint_address($natent['source']);
142
			$source_cidr = strstr($source_net, '/');
143
			$destination_net = pprint_address($natent['destination']);
144
			$destination_cidr = strstr($destination_net, '/');
145
                    ?>
146
                  <td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
147
                    <?php 		echo $textss . $destination_net . $textse; ?>
148
                  </td>
149
                  <td class="listr" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
150
                    <?php 		echo $textss . $source_net . $textse; ?>
151
                  </td>
152
                  <td class="listbg" ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
153
			<?=$textss;?>
154
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
155
			<?=$textse;?>
156
                  </td>
157
                  <td class="list nowrap">
158
                    <table border="0" cellspacing="0" cellpadding="1" summary="edit">
159
                      <tr>
160
                        <td valign="middle"><a href="firewall_nat_npt_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit rule"); ?>" alt="edit" /></a></td>
161
			<td valign="middle"><a href="firewall_nat_npt.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("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="<?=gettext("delete rule"); ?>" alt="delete" /></a></td>
162
                      </tr>
163
                    </table>
164
                  </td>
165
                </tr>
166
		<?php $i++; endforeach; ?>
167
                <tr>
168
                  <td class="list" colspan="4"></td>
169
                  <td class="list">
170
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
171
                      <tr>
172
			<td width="17"></td>
173
                        <td valign="middle"><a href="firewall_nat_npt_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add rule"); ?>" alt="add" /></a></td>
174
                      </tr>
175
                    </table>
176
                  </td>
177
                </tr>
178
              </table>
179
	    </div>
180
	</td>
181
</tr>
182
</table>
183
</form>
184
<?php include("fend.inc"); ?>
185
</body>
186
</html>
(67-67/256)