Project

General

Profile

Download (21 KB) Statistics
| Branch: | Tag: | Revision:
1 19ae0929 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
    firewall_nat_out.php
5 c55b323d Scott Ullrich
    Copyright (C) 2004 Scott Ullrich
6
    All rights reserved.
7 19ae0929 Scott Ullrich
8 c55b323d Scott Ullrich
    originally part of m0n0wall (http://m0n0.ch/wall)
9 5b237745 Scott Ullrich
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
    All rights reserved.
11 19ae0929 Scott Ullrich
12 5b237745 Scott Ullrich
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14 19ae0929 Scott Ullrich
15 5b237745 Scott Ullrich
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17 19ae0929 Scott Ullrich
18 5b237745 Scott Ullrich
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21 19ae0929 Scott Ullrich
22 5b237745 Scott Ullrich
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33 7ac5a4cb Scott Ullrich
/*
34
	pfSense_MODULE:	nat
35
*/
36 5b237745 Scott Ullrich
37 6b07c15a Matthew Grooms
##|+PRIV
38
##|*IDENT=page-firewall-nat-outbound
39
##|*NAME=Firewall: NAT: Outbound page
40
##|*DESCR=Allow access to the 'Firewall: NAT: Outbound' page.
41
##|*MATCH=firewall_nat_out.php*
42
##|-PRIV
43
44 5b237745 Scott Ullrich
require("guiconfig.inc");
45 7a927e67 Scott Ullrich
require_once("functions.inc");
46
require_once("filter.inc");
47
require_once("shaper.inc");
48 5b237745 Scott Ullrich
49 c44d3cf7 Ermal Lu?i
if (!is_array($config['nat']['advancedoutbound']))
50
	$config['nat']['advancedoutbound'] = array();
51
52 5b237745 Scott Ullrich
if (!is_array($config['nat']['advancedoutbound']['rule']))
53 82d0dfc4 Scott Ullrich
	$config['nat']['advancedoutbound']['rule'] = array();
54 19ae0929 Scott Ullrich
55 5b237745 Scott Ullrich
$a_out = &$config['nat']['advancedoutbound']['rule'];
56
57 82d0dfc4 Scott Ullrich
if ($_POST['apply']) {
58
	write_config();
59 5b237745 Scott Ullrich
60 82d0dfc4 Scott Ullrich
	$retval = 0;
61 920b3bb0 Scott Ullrich
	$retval |= filter_configure();
62
63 e8c2c890 Bill Marquette
	if(stristr($retval, "error") <> true)
64
	        $savemsg = get_std_save_message($retval);
65
	else
66
		$savemsg = $retval;
67 19ae0929 Scott Ullrich
68 82d0dfc4 Scott Ullrich
	if ($retval == 0) {
69 a368a026 Ermal Lu?i
		clear_subsystem_dirty('natconf');
70
		clear_subsystem_dirty('filter');
71 9c96aff5 Bill Marquette
        }
72 5b237745 Scott Ullrich
}
73
74 fe693b89 Bill Marquette
75
76 82d0dfc4 Scott Ullrich
if (isset($_POST['save']) && $_POST['save'] == "Save") {
77 53bf5f1d Seth Mos
	/* mutually exclusive settings - if user wants advanced NAT, we don't generate automatic rules */
78 82d0dfc4 Scott Ullrich
	switch ($_POST['advancedoripsec']) {
79
	case "ipsecpassthru":
80
               	$config['nat']['ipsecpassthru']['enable'] = true;
81
               	unset($config['nat']['advancedoutbound']['enable']);
82
		break;
83
	case "advancedoutboundnat":
84 1ddb870b Ermal Lu?i
        	if (!isset($config['nat']['advancedoutbound']['enable'])) {
85
			$config['nat']['advancedoutbound']['enable'] = true;
86 4a3cb40c Chris Buechler
			// if there are already AON rules configured, don't generate default ones
87
			if(!empty($a_out))
88
				continue;
89 82d0dfc4 Scott Ullrich
			/*
90 4a3cb40c Chris Buechler
			 *    user has enabled advanced outbound NAT and doesn't have rules
91
			 *    lets automatically create entries
92 82d0dfc4 Scott Ullrich
			 *    for all of the interfaces to make life easier on the pip-o-chap
93
			 */
94 cbe3ea96 Ermal Luçi
			$ifdescrs = get_configured_interface_with_descr();
95
				
96
			foreach($ifdescrs as $if => $ifdesc) {
97 a55e9c70 Ermal Lu?i
				if (interface_has_gateway($if))
98 e1f675e4 Ermal Luçi
					continue;
99 a55e9c70 Ermal Lu?i
				$osipaddr = get_interface_ip($if);
100
				$ossubnet = get_interface_subnet($if);
101
				if (!is_ipaddr($osipaddr) || empty($ossubnet))
102
					continue;
103
				$osn = gen_subnet($osipaddr, $ossubnet);
104 1ddb870b Ermal Lu?i
				foreach ($ifdescrs as $if2 => $ifdesc2) {
105
					if (!interface_has_gateway($if2))
106
						continue;
107 aad51dbf Ermal Lu?i
108 1ddb870b Ermal Lu?i
					$natent = array();
109
					$natent['source']['network'] = "{$osn}/{$ossubnet}";
110 d2243cff Chris Buechler
					$natent['dstport'] = "500";
111 ddc55e12 Erik Fonnesbeck
					$natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc,$ifdesc2);
112 1ddb870b Ermal Lu?i
					$natent['target'] = "";
113
					$natent['interface'] = $if2;
114
					$natent['destination']['any'] = true;
115 d2243cff Chris Buechler
					$natent['staticnatport'] = true;
116 1ddb870b Ermal Lu?i
					$a_out[] = $natent;
117
					
118
					$natent = array();
119
                                        $natent['source']['network'] = "{$osn}/{$ossubnet}";
120
                                        $natent['sourceport'] = "";
121 ddc55e12 Erik Fonnesbeck
                                        $natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc,$ifdesc2);
122 1ddb870b Ermal Lu?i
                                        $natent['target'] = "";
123
                                        $natent['interface'] = $if2;
124
                                        $natent['destination']['any'] = true;
125
                                        $natent['natport'] = "";
126
                                        $a_out[] = $natent;
127 4b85f096 Chris Buechler
					
128
					/* PPTP subnet */
129
					if($config['pptpd']['mode'] == "server") {
130
						if (is_ipaddr($config['pptpd']['localip'])) {
131
							if($config['pptpd']['pptp_subnet'] <> "")
132
								$ossubnet = $config['pptpd']['pptp_subnet'];
133
							else
134
								$ossubnet = "32";
135 fbd96b06 Erik Fonnesbeck
							$osn = gen_subnet($config['pptpd']['localip'], $ossubnet);
136 4b85f096 Chris Buechler
							$natent = array();
137
							$natent['source']['network'] = "{$osn}/{$ossubnet}";
138
							$natent['sourceport'] = "";
139 ff01cbff Vinicius Coque
							$natent['descr'] = gettext("Auto created rule for PPTP server");
140 4b85f096 Chris Buechler
							$natent['target'] = "";
141
							$natent['interface'] = $if2;
142
							$natent['destination']['any'] = true;
143
							$natent['natport'] = "";
144
							$a_out[] = $natent;
145
						}
146
					}
147
					/* PPPoE subnet */
148
					if($config['pppoe']['mode'] == "server") {
149
						if (is_ipaddr($config['pppoe']['localip'])) {
150
							if($config['pppoe']['pppoe_subnet'] <> "")
151 fbd96b06 Erik Fonnesbeck
								$ossubnet = $config['pppoe']['pppoe_subnet'];
152 4b85f096 Chris Buechler
							else
153
								$ossubnet = "32";
154 fbd96b06 Erik Fonnesbeck
							$osn = gen_subnet($config['pppoe']['localip'], $ossubnet);
155 4b85f096 Chris Buechler
							$natent = array();
156
							$natent['source']['network'] = "{$osn}/{$ossubnet}";
157
							$natent['sourceport'] = "";
158 ff01cbff Vinicius Coque
							$natent['descr'] = gettext("Auto created rule for PPPoE server");
159 4b85f096 Chris Buechler
							$natent['target'] = "";
160
							$natent['interface'] = $if2;
161
							$natent['destination']['any'] = true;
162
							$natent['natport'] = "";
163
							$a_out[] = $natent;
164
						}
165
					}
166
					/* L2TP subnet */
167
					if($config['l2tp']['mode'] == "server") {
168
						if (is_ipaddr($config['l2tp']['localip'])) {
169
							if($config['l2tp']['l2tp_subnet'] <> "")
170 fbd96b06 Erik Fonnesbeck
								$ossubnet = $config['l2tp']['l2tp_subnet'];
171 4b85f096 Chris Buechler
							else
172
								$ossubnet = "32";
173 fbd96b06 Erik Fonnesbeck
							$osn = gen_subnet($config['l2tp']['localip'], $ossubnet);
174 4b85f096 Chris Buechler
							$natent = array();
175
							$natent['source']['network'] = "{$osn}/{$ossubnet}";
176
							$natent['sourceport'] = "";
177 ff01cbff Vinicius Coque
							$natent['descr'] = gettext("Auto created rule for L2TP server");
178 4b85f096 Chris Buechler
							$natent['target'] = "";
179
							$natent['interface'] = $if2;
180
							$natent['destination']['any'] = true;
181
							$natent['natport'] = "";
182
							$a_out[] = $natent;
183
						}
184
					}
185
					/* add openvpn interfaces */
186
					if($config['openvpn']['openvpn-server']) {
187
						foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) {
188
							$natent = array();
189
							$natent['source']['network'] = $ovpnsrv['tunnel_network'];
190
							$natent['sourceport'] = "";
191 ff01cbff Vinicius Coque
							$natent['descr'] = gettext("Auto created rule for OpenVPN server");
192 4b85f096 Chris Buechler
							$natent['target'] = "";
193
							$natent['interface'] = $if2;
194
							$natent['destination']['any'] = true;
195
							$natent['natport'] = "";
196
							$a_out[] = $natent;
197
						}
198
					}
199 1ddb870b Ermal Lu?i
				}	
200 fa56ab75 Scott Ullrich
			}
201 4b85f096 Chris Buechler
202 ff01cbff Vinicius Coque
			$savemsg = gettext("Default rules for each interface have been created.");
203 82d0dfc4 Scott Ullrich
		}
204
		break;
205
	}
206 63868cb8 Scott Ullrich
        write_config();
207 a368a026 Ermal Lu?i
	mark_subsystem_dirty('natconf');
208 63868cb8 Scott Ullrich
        header("Location: firewall_nat_out.php");
209
        exit;
210 fe693b89 Bill Marquette
}
211
212 9c96aff5 Bill Marquette
if (isset($_POST['del_x'])) {
213
        /* delete selected rules */
214
        if (is_array($_POST['rule']) && count($_POST['rule'])) {
215
                foreach ($_POST['rule'] as $rulei) {
216
                        unset($a_out[$rulei]);
217
                }
218
                write_config();
219 a368a026 Ermal Lu?i
		mark_subsystem_dirty('natconf');
220 9c96aff5 Bill Marquette
                header("Location: firewall_nat_out.php");
221
                exit;
222
        }
223
224
} else {
225 87b10bed Bill Marquette
        /* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
226 9c96aff5 Bill Marquette
        unset($movebtn);
227
        foreach ($_POST as $pn => $pd) {
228
                if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
229
                        $movebtn = $matches[1];
230
                        break;
231
                }
232
        }
233
        /* move selected rules before this rule */
234
        if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
235
                $a_out_new = array();
236
237
                /* copy all rules < $movebtn and not selected */
238
                for ($i = 0; $i < $movebtn; $i++) {
239
                        if (!in_array($i, $_POST['rule']))
240
                                $a_out_new[] = $a_out[$i];
241
                }
242
243
                /* copy all selected rules */
244
                for ($i = 0; $i < count($a_out); $i++) {
245
                        if ($i == $movebtn)
246
                                continue;
247
                        if (in_array($i, $_POST['rule']))
248
                                $a_out_new[] = $a_out[$i];
249
                }
250
251
                /* copy $movebtn rule */
252
                if ($movebtn < count($a_out))
253
                        $a_out_new[] = $a_out[$movebtn];
254
255
                /* copy all rules > $movebtn and not selected */
256
                for ($i = $movebtn+1; $i < count($a_out); $i++) {
257
                        if (!in_array($i, $_POST['rule']))
258
                                $a_out_new[] = $a_out[$i];
259
                }
260 82d0dfc4 Scott Ullrich
                if (count($a_out_new) > 0)
261
			$a_out = $a_out_new;
262
		else
263
			unset($config['nat']['advancedoutbound']);
264
265 9c96aff5 Bill Marquette
                write_config();
266 a368a026 Ermal Lu?i
		mark_subsystem_dirty('natconf');
267 9c96aff5 Bill Marquette
                header("Location: firewall_nat_out.php");
268
                exit;
269
        }
270 5b237745 Scott Ullrich
}
271 9c96aff5 Bill Marquette
272
273 ff01cbff Vinicius Coque
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
274 6eb17647 Scott Ullrich
include("head.inc");
275
276 24f600b0 Scott Ullrich
?>
277 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
278
<?php include("fbegin.inc"); ?>
279 fe693b89 Bill Marquette
<form action="firewall_nat_out.php" method="post" name="iform">
280 625dcc40 Bill Marquette
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js">
281 3f57ceee Bill Marquette
</script>
282 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
283 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('natconf')): ?><p>
284 fe710877 Vinicius Coque
<?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>
285 5b237745 Scott Ullrich
<?php endif; ?>
286
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
287 a8726a3d Scott Ullrich
<?php
288
	$tab_array = array();
289 ff01cbff Vinicius Coque
	$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
290 2ca03544 Carlos Eduardo Ramos
	$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
291 ff01cbff Vinicius Coque
	$tab_array[] = array(gettext("Outbound"), true, "firewall_nat_out.php");
292 a8726a3d Scott Ullrich
	display_top_tabs($tab_array);
293
?>
294 5b237745 Scott Ullrich
  </td></tr>
295 19ae0929 Scott Ullrich
  <tr>
296 d732f186 Bill Marquette
    <td>
297
	<div id="mainarea">
298 5d2c6f3e Scott Ullrich
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
299 2ca03544 Carlos Eduardo Ramos
				<tr><td align="right"><b><?=gettext("Mode:"); ?></b></td>
300 d5475741 Scott Ullrich
                  <td>
301
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="ipsecpassthru" value="ipsecpassthru" <?php if (isset($config['nat']['ipsecpassthru']['enable'])) echo "checked";?>>
302 bc381f9a Carlos Eduardo Ramos
                      <strong><?=gettext("Automatic outbound NAT rule generation"); ?><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?=gettext("(IPsec passthrough included)");?></strong>
303 6b3a7398 Scott Ullrich
                  </td>
304 5d2c6f3e Scott Ullrich
305 d5475741 Scott Ullrich
                  <td>
306
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="advancedoutbound" value="advancedoutboundnat" <?php if (isset($config['nat']['advancedoutbound']['enable'])) echo "checked";?>>
307 74aff49c Renato Botelho
                      <strong><?=gettext("Manual Outbound NAT rule generation") . "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . gettext("(AON - Advanced Outbound NAT)");?></strong></td>
308 52b8dc16 Scott Ullrich
                  <td valign="middle" align="left">
309 74aff49c Renato Botelho
					<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>">
310 d5475741 Scott Ullrich
					&nbsp;<br/>&nbsp;
311 5b237745 Scott Ullrich
                  </td>
312
                </tr>
313 5d2c6f3e Scott Ullrich
				<tr>
314
					<td colspan="5">
315
						&nbsp;
316
					</td>
317
				</tr>
318
				<tr>
319
					<td  class="vtable" colspan="5">
320
						&nbsp;
321
					</td>
322
				</tr>
323 5b237745 Scott Ullrich
              </table>
324 d732f186 Bill Marquette
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
325 2ca03544 Carlos Eduardo Ramos
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Mappings:"); ?></b></td></tr>
326 d5475741 Scott Ullrich
				<tr><td>&nbsp;</td></tr>
327 3f57ceee Bill Marquette
                <tr id="frheader">
328
                  <td width="3%" class="list">&nbsp;</td>
329
                  <td width="3%" class="list">&nbsp;</td>
330 ff01cbff Vinicius Coque
                  <td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
331
                  <td width="15%" class="listhdrr"><?=gettext("Source");?></td>
332
                  <td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
333
                  <td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
334
                  <td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
335
                  <td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
336
                  <td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
337
		  <td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
338
                  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
339 d415d821 Seth Mos
                  <td width="5%" class="list">
340
                    <table border="0" cellspacing="0" cellpadding="1">
341
                      <tr>
342
			<td width="17"></td>
343 ff01cbff Vinicius Coque
                        <td><a href="firewall_nat_out_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>"></a></td>
344 d415d821 Seth Mos
                      </tr>
345
                    </table>
346
		  </td>
347 5b237745 Scott Ullrich
                </tr>
348 9c96aff5 Bill Marquette
              <?php $nnats = $i = 0; foreach ($a_out as $natent): ?>
349 3f57ceee Bill Marquette
                <tr valign="top" id="fr<?=$nnats;?>">
350
                  <td class="listt"><input type="checkbox" id="frc<?=$nnats;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nnats;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
351 3364bed4 Bill Marquette
                  <td class="listt" align="center"></td>
352 f8b8c2fd Bill Marquette
                  <td class="listlr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
353 5b237745 Scott Ullrich
                    <?php
354 8b35aa77 Erik Fonnesbeck
					if (!$natent['interface'])
355
					  	echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
356 5b237745 Scott Ullrich
					else
357 8b35aa77 Erik Fonnesbeck
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
358 5b237745 Scott Ullrich
					?>
359 19f09ae1 Scott Ullrich
                                        &nbsp;
360 5b237745 Scott Ullrich
                  </td>
361 f8b8c2fd Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
362 5b237745 Scott Ullrich
                    <?=$natent['source']['network'];?>
363
                  </td>
364 a88aca62 Scott Ullrich
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
365
                    <?php
366
                      if (!$natent['sourceport'])
367
                          echo "*";
368
                      else
369
                          echo $natent['sourceport'];
370
                    ?>
371
                  </td>
372 f8b8c2fd Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
373 5b237745 Scott Ullrich
                    <?php
374
                      if (isset($natent['destination']['any']))
375
                          echo "*";
376
                      else {
377
                          if (isset($natent['destination']['not']))
378
                              echo "!&nbsp;";
379 2e56710c Scott Ullrich
                          echo $natent['destination']['address'];
380 5b237745 Scott Ullrich
                      }
381
                    ?>
382
                  </td>
383 f8b8c2fd Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
384 a539f08b Bill Marquette
                    <?php
385 a88aca62 Scott Ullrich
                      if (!$natent['dstport'])
386 a539f08b Bill Marquette
                          echo "*";
387
                      else
388 a88aca62 Scott Ullrich
                          echo $natent['dstport'];
389 a539f08b Bill Marquette
                    ?>
390
                  </td>
391 f8b8c2fd Bill Marquette
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
392 5b237745 Scott Ullrich
                    <?php
393
                      if (!$natent['target'])
394
                          echo "*";
395
                      else
396
                          echo $natent['target'];
397
                    ?>
398
                  </td>
399 4d38bfc3 Scott Ullrich
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
400
                    <?php
401 3af33993 Scott Ullrich
                      if (!$natent['natport'])
402 4d38bfc3 Scott Ullrich
                          echo "*";
403
                      else
404 3af33993 Scott Ullrich
                          echo $natent['natport'];
405
                    ?>
406 5d8b0205 Scott Ullrich
                  </td>
407
                  <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
408
                    <?php
409 b6905de8 Scott Ullrich
			if(isset($natent['staticnatport']))
410 ff01cbff Vinicius Coque
			    echo "<CENTER>" . gettext("YES") . "</CENTER>";
411 b6905de8 Scott Ullrich
			else
412 ff01cbff Vinicius Coque
			    echo "<CENTER>" . gettext("NO") . "</CENTER>";
413 5d8b0205 Scott Ullrich
                    ?>		    
414 4d38bfc3 Scott Ullrich
                  </td>
415 f8b8c2fd Bill Marquette
                  <td class="listbg"  onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
416 64286300 Scott Ullrich
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
417 5b237745 Scott Ullrich
                  </td>
418 9c96aff5 Bill Marquette
                  <td class="list" valign="middle" nowrap>
419
                    <table border="0" cellspacing="0" cellpadding="1">
420
                      <tr>
421 ff01cbff Vinicius Coque
                        <td><a href="firewall_nat_out_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit mapping");?>"></a></td>
422 9c96aff5 Bill Marquette
                      </tr>
423
                      <tr>
424 ff01cbff Vinicius Coque
                        <td><input onmouseover="fr_insline(<?=$nnats;?>, true)" onmouseout="fr_insline(<?=$nnats;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected rules before this rule");?>" height="17" type="image" width="17" border="0"></td>
425
                        <td><a href="firewall_nat_out_edit.php?dup=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new nat based on this one");?>" width="17" height="17" border="0"></a></td>
426 9c96aff5 Bill Marquette
                      </tr>
427
                    </table>
428
              <?php $i++; $nnats++; endforeach; ?>
429 19ae0929 Scott Ullrich
                <tr>
430 3af33993 Scott Ullrich
                  <td class="list" colspan="11"></td>
431 9c96aff5 Bill Marquette
                  <td class="list" valign="middle" nowrap>
432
                    <table border="0" cellspacing="0" cellpadding="1">
433
                      <tr>
434 ff01cbff Vinicius Coque
                        <td><?php if ($nnats == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected mappings to end");?>" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="<?=gettext("move selected mappings to end");?>" border="0"><?php endif; ?></td>
435
                        <td><a href="firewall_nat_out_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>"></a></td>
436 9c96aff5 Bill Marquette
                      </tr>
437
                      <tr>
438 ff01cbff Vinicius Coque
                        <td><?php if ($nnats == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0"><?php else: ?><input name="del" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="<?=gettext("delete selected mappings");?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected mappings?");?>')"><?php endif; ?></td>
439 9c96aff5 Bill Marquette
                      </tr>
440
                    </table></td>
441 5b237745 Scott Ullrich
                </tr>
442 d5475741 Scott Ullrich
                <tr>
443
                  <td colspan="12">
444 2ca03544 Carlos Eduardo Ramos
					<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br>
445 1dc3df62 Carlos Eduardo Ramos
                      </strong></span><?=gettext("If advanced outbound NAT is enabled, no outbound NAT " .
446
                      "rules will be automatically generated any longer. Instead, only the mappings " .
447
                      "you specify below will be used. With advanced outbound NAT disabled, " .
448
                      "a mapping is automatically created for each interface's subnet " .
449
                      "(except WAN).  If you use target addresses other than the WAN interface's " .
450
		      "IP address, then depending on the way your WAN connection is setup, you " .
451 2ca03544 Carlos Eduardo Ramos
	              "may also need a"); ?> <a href="firewall_virtual_ip.php"><?=gettext("Virtual IP."); ?></a></span><br>
452 d5475741 Scott Ullrich
                    </td>
453
                </tr>
454
455 5b237745 Scott Ullrich
              </table>
456 d732f186 Bill Marquette
	    </div>
457 5b237745 Scott Ullrich
</td>
458
  </tr>
459
</table>
460
            </form>
461
<?php include("fend.inc"); ?>
462
</body>
463
</html>