Project

General

Profile

Download (23.1 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 e538fc18 Renato Botelho
				if (substr(get_real_interface($if), 0, 4) == "ovpn")
98
					continue;
99 a1776dcf jim-p
				if (!interface_has_gateway($if))
100 e1f675e4 Ermal Luçi
					continue;
101 1ddb870b Ermal Lu?i
				foreach ($ifdescrs as $if2 => $ifdesc2) {
102 a1776dcf jim-p
					if (interface_has_gateway($if2))
103
						continue;
104
105
					$osipaddr = get_interface_ip($if2);
106
					$ossubnet = get_interface_subnet($if2);
107
					if (!is_ipaddr($osipaddr) || empty($ossubnet))
108 1ddb870b Ermal Lu?i
						continue;
109 a1776dcf jim-p
					$osn = gen_subnet($osipaddr, $ossubnet);
110 aad51dbf Ermal Lu?i
111 1ddb870b Ermal Lu?i
					$natent = array();
112
					$natent['source']['network'] = "{$osn}/{$ossubnet}";
113 d2243cff Chris Buechler
					$natent['dstport'] = "500";
114 a1776dcf jim-p
					$natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc2,$ifdesc);
115 1ddb870b Ermal Lu?i
					$natent['target'] = "";
116 a1776dcf jim-p
					$natent['interface'] = $if;
117 1ddb870b Ermal Lu?i
					$natent['destination']['any'] = true;
118 d2243cff Chris Buechler
					$natent['staticnatport'] = true;
119 33cc1e86 jim-p
					$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
120 1ddb870b Ermal Lu?i
					$a_out[] = $natent;
121 a1776dcf jim-p
122 1ddb870b Ermal Lu?i
					$natent = array();
123 a1776dcf jim-p
					$natent['source']['network'] = "{$osn}/{$ossubnet}";
124
					$natent['sourceport'] = "";
125
					$natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc2,$ifdesc);
126
					$natent['target'] = "";
127
					$natent['interface'] = $if;
128
					$natent['destination']['any'] = true;
129
					$natent['natport'] = "";
130 33cc1e86 jim-p
					$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
131 a1776dcf jim-p
					$a_out[] = $natent;
132
				}
133
				/* Localhost */
134
				$natent = array();
135
				$natent['source']['network'] = "127.0.0.0/8";
136
				$natent['dstport'] = "";
137
				$natent['descr'] = sprintf(gettext('Auto created rule for localhost to %1$s'),$ifdesc);
138
				$natent['target'] = "";
139
				$natent['interface'] = $if;
140
				$natent['destination']['any'] = true;
141
				$natent['staticnatport'] = false;
142
				$natent['natport'] = "1024:65535";
143
				$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
144
				$a_out[] = $natent;
145
				/* PPTP subnet */
146
				if (($config['pptpd']['mode'] == "server") && is_private_ip($config['pptpd']['remoteip'])) {
147
					$pptp_size = empty($config['pptpd']['n_pptp_units']) ? 16 : $config['pptpd']['n_pptp_units'];
148
					$pptptopip = $pptp_size - 1;
149
					$pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$pptptopip));
150
					foreach ($pptp_subnets as $pptpsn) {
151
						$natent = array();
152
						$natent['source']['network'] = $pptpsn;
153
						$natent['sourceport'] = "";
154
						$natent['descr'] = gettext("Auto created rule for PPTP server");
155
						$natent['target'] = "";
156
						$natent['interface'] = $if;
157
						$natent['destination']['any'] = true;
158
						$natent['natport'] = "";
159
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
160
						$a_out[] = $natent;
161 4b85f096 Chris Buechler
					}
162 a1776dcf jim-p
				}
163
				/* PPPoE subnet */
164
				if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
165
					foreach ($config['pppoes']['pppoe'] as $pppoes) {
166
						if (($pppoes['mode'] == "server") && is_ipaddr($pppoes['localip'])) {
167
							if($pppoes['pppoe_subnet'] <> "")
168
								$ossubnet = $pppoes['pppoe_subnet'];
169 4b85f096 Chris Buechler
							else
170
								$ossubnet = "32";
171 a1776dcf jim-p
							$osn = gen_subnet($pppoes['localip'], $ossubnet);
172 4b85f096 Chris Buechler
							$natent = array();
173
							$natent['source']['network'] = "{$osn}/{$ossubnet}";
174
							$natent['sourceport'] = "";
175 a1776dcf jim-p
							$natent['descr'] = gettext("Auto created rule for PPPoE server");
176 4b85f096 Chris Buechler
							$natent['target'] = "";
177 a1776dcf jim-p
							$natent['interface'] = $if;
178 4b85f096 Chris Buechler
							$natent['destination']['any'] = true;
179
							$natent['natport'] = "";
180 33cc1e86 jim-p
							$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
181 4b85f096 Chris Buechler
							$a_out[] = $natent;
182
						}
183
					}
184 a1776dcf jim-p
				}
185
				/* L2TP subnet */
186
				if($config['l2tp']['mode'] == "server") {
187
					if (is_ipaddr($config['l2tp']['localip'])) {
188
						if($config['l2tp']['l2tp_subnet'] <> "")
189
							$ossubnet = $config['l2tp']['l2tp_subnet'];
190
						else
191
							$ossubnet = "32";
192
						$osn = gen_subnet($config['l2tp']['localip'], $ossubnet);
193
						$natent = array();
194
						$natent['source']['network'] = "{$osn}/{$ossubnet}";
195
						$natent['sourceport'] = "";
196
						$natent['descr'] = gettext("Auto created rule for L2TP server");
197
						$natent['target'] = "";
198
						$natent['interface'] = $if;
199
						$natent['destination']['any'] = true;
200
						$natent['natport'] = "";
201
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
202
						$a_out[] = $natent;
203
					}
204
				}
205
				/* add openvpn interfaces */
206
				if($config['openvpn']['openvpn-server']) {
207
					foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) {
208
						$natent = array();
209
						$natent['source']['network'] = $ovpnsrv['tunnel_network'];
210
						$natent['sourceport'] = "";
211
						$natent['descr'] = gettext("Auto created rule for OpenVPN server");
212
						$natent['target'] = "";
213
						$natent['interface'] = $if;
214
						$natent['destination']['any'] = true;
215
						$natent['natport'] = "";
216
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
217
						$a_out[] = $natent;
218 4b85f096 Chris Buechler
					}
219 a1776dcf jim-p
				}
220 fa56ab75 Scott Ullrich
			}
221 4b85f096 Chris Buechler
222 ff01cbff Vinicius Coque
			$savemsg = gettext("Default rules for each interface have been created.");
223 82d0dfc4 Scott Ullrich
		}
224
		break;
225
	}
226 3a343d73 jim-p
	if (write_config())
227
		mark_subsystem_dirty('natconf');
228 63868cb8 Scott Ullrich
        header("Location: firewall_nat_out.php");
229
        exit;
230 fe693b89 Bill Marquette
}
231
232 dd65598e Darren Embry
if ($_GET['act'] == "del") {
233
	if ($a_out[$_GET['id']]) {
234
		unset($a_out[$_GET['id']]);
235 3a343d73 jim-p
		if (write_config())
236
			mark_subsystem_dirty('natconf');
237 dd65598e Darren Embry
		header("Location: firewall_nat_out.php");
238
		exit;
239
	}
240
}
241
242 9c96aff5 Bill Marquette
if (isset($_POST['del_x'])) {
243
        /* delete selected rules */
244
        if (is_array($_POST['rule']) && count($_POST['rule'])) {
245
                foreach ($_POST['rule'] as $rulei) {
246
                        unset($a_out[$rulei]);
247
                }
248 3a343d73 jim-p
		if (write_config())
249
			mark_subsystem_dirty('natconf');
250 9c96aff5 Bill Marquette
                header("Location: firewall_nat_out.php");
251
                exit;
252
        }
253
254
} else {
255 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... */
256 9c96aff5 Bill Marquette
        unset($movebtn);
257
        foreach ($_POST as $pn => $pd) {
258
                if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
259
                        $movebtn = $matches[1];
260
                        break;
261
                }
262
        }
263
        /* move selected rules before this rule */
264
        if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
265
                $a_out_new = array();
266
267
                /* copy all rules < $movebtn and not selected */
268
                for ($i = 0; $i < $movebtn; $i++) {
269
                        if (!in_array($i, $_POST['rule']))
270
                                $a_out_new[] = $a_out[$i];
271
                }
272
273
                /* copy all selected rules */
274
                for ($i = 0; $i < count($a_out); $i++) {
275
                        if ($i == $movebtn)
276
                                continue;
277
                        if (in_array($i, $_POST['rule']))
278
                                $a_out_new[] = $a_out[$i];
279
                }
280
281
                /* copy $movebtn rule */
282
                if ($movebtn < count($a_out))
283
                        $a_out_new[] = $a_out[$movebtn];
284
285
                /* copy all rules > $movebtn and not selected */
286
                for ($i = $movebtn+1; $i < count($a_out); $i++) {
287
                        if (!in_array($i, $_POST['rule']))
288
                                $a_out_new[] = $a_out[$i];
289
                }
290 82d0dfc4 Scott Ullrich
                if (count($a_out_new) > 0)
291
			$a_out = $a_out_new;
292
		else
293
			unset($config['nat']['advancedoutbound']);
294
295 3a343d73 jim-p
		if (write_config())
296
			mark_subsystem_dirty('natconf');
297 9c96aff5 Bill Marquette
                header("Location: firewall_nat_out.php");
298
                exit;
299
        }
300 5b237745 Scott Ullrich
}
301 9c96aff5 Bill Marquette
302
303 ff01cbff Vinicius Coque
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
304 6eb17647 Scott Ullrich
include("head.inc");
305
306 24f600b0 Scott Ullrich
?>
307 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
308
<?php include("fbegin.inc"); ?>
309 fe693b89 Bill Marquette
<form action="firewall_nat_out.php" method="post" name="iform">
310 1d89d699 Colin Fleming
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js"></script>
311 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
312 1d89d699 Colin Fleming
<?php if (is_subsystem_dirty('natconf')): ?>
313
<?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/>
314 5b237745 Scott Ullrich
<?php endif; ?>
315 1d89d699 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firwall nat outbound">  <tr><td>
316 a8726a3d Scott Ullrich
<?php
317
	$tab_array = array();
318 ff01cbff Vinicius Coque
	$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
319 2ca03544 Carlos Eduardo Ramos
	$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
320 ff01cbff Vinicius Coque
	$tab_array[] = array(gettext("Outbound"), true, "firewall_nat_out.php");
321 292ef22a Seth Mos
	$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
322 a8726a3d Scott Ullrich
	display_top_tabs($tab_array);
323
?>
324 5b237745 Scott Ullrich
  </td></tr>
325 19ae0929 Scott Ullrich
  <tr>
326 d732f186 Bill Marquette
    <td>
327
	<div id="mainarea">
328 1d89d699 Colin Fleming
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
329 2ca03544 Carlos Eduardo Ramos
				<tr><td align="right"><b><?=gettext("Mode:"); ?></b></td>
330 d5475741 Scott Ullrich
                  <td>
331 1d89d699 Colin Fleming
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="ipsecpassthru" value="ipsecpassthru" <?php if (isset($config['nat']['ipsecpassthru']['enable'])) echo "checked=\"checked\"";?> />
332 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>
333 6b3a7398 Scott Ullrich
                  </td>
334 5d2c6f3e Scott Ullrich
335 d5475741 Scott Ullrich
                  <td>
336 1d89d699 Colin Fleming
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="advancedoutbound" value="advancedoutboundnat" <?php if (isset($config['nat']['advancedoutbound']['enable'])) echo "checked=\"checked\"";?> />
337 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>
338 52b8dc16 Scott Ullrich
                  <td valign="middle" align="left">
339 1d89d699 Colin Fleming
					<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
340 d5475741 Scott Ullrich
					&nbsp;<br/>&nbsp;
341 5b237745 Scott Ullrich
                  </td>
342
                </tr>
343 5d2c6f3e Scott Ullrich
				<tr>
344
					<td colspan="5">
345
						&nbsp;
346
					</td>
347
				</tr>
348
				<tr>
349
					<td  class="vtable" colspan="5">
350
						&nbsp;
351
					</td>
352
				</tr>
353 5b237745 Scott Ullrich
              </table>
354 1d89d699 Colin Fleming
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="mappings">
355 2ca03544 Carlos Eduardo Ramos
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Mappings:"); ?></b></td></tr>
356 d5475741 Scott Ullrich
				<tr><td>&nbsp;</td></tr>
357 3f57ceee Bill Marquette
                <tr id="frheader">
358
                  <td width="3%" class="list">&nbsp;</td>
359
                  <td width="3%" class="list">&nbsp;</td>
360 ff01cbff Vinicius Coque
                  <td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
361
                  <td width="15%" class="listhdrr"><?=gettext("Source");?></td>
362
                  <td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
363
                  <td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
364
                  <td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
365
                  <td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
366
                  <td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
367
		  <td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
368
                  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
369 d415d821 Seth Mos
                  <td width="5%" class="list">
370 1d89d699 Colin Fleming
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
371 d415d821 Seth Mos
                      <tr>
372
			<td width="17"></td>
373 1d89d699 Colin Fleming
                        <td><a href="firewall_nat_out_edit.php?after=-1"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" /></a></td>
374 d415d821 Seth Mos
                      </tr>
375
                    </table>
376
		  </td>
377 5b237745 Scott Ullrich
                </tr>
378 d5d6c0ad Erik Fonnesbeck
              <?php $nnats = $i = 0; foreach ($a_out as $natent): ?>
379 3f57ceee Bill Marquette
                <tr valign="top" id="fr<?=$nnats;?>">
380 1d89d699 Colin Fleming
                  <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>
381 3364bed4 Bill Marquette
                  <td class="listt" align="center"></td>
382 1d89d699 Colin Fleming
                  <td class="listlr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
383 d5d6c0ad Erik Fonnesbeck
                    <?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
384 19f09ae1 Scott Ullrich
                                        &nbsp;
385 5b237745 Scott Ullrich
                  </td>
386 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
387 5b237745 Scott Ullrich
                    <?=$natent['source']['network'];?>
388
                  </td>
389 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
390 a88aca62 Scott Ullrich
                    <?php
391 1c4edc3c jim-p
			echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
392 a88aca62 Scott Ullrich
                      if (!$natent['sourceport'])
393
                          echo "*";
394
                      else
395
                          echo $natent['sourceport'];
396
                    ?>
397
                  </td>
398 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
399 5b237745 Scott Ullrich
                    <?php
400
                      if (isset($natent['destination']['any']))
401
                          echo "*";
402
                      else {
403
                          if (isset($natent['destination']['not']))
404
                              echo "!&nbsp;";
405 2e56710c Scott Ullrich
                          echo $natent['destination']['address'];
406 5b237745 Scott Ullrich
                      }
407
                    ?>
408
                  </td>
409 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
410 a539f08b Bill Marquette
                    <?php
411 1c4edc3c jim-p
			echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
412 a88aca62 Scott Ullrich
                      if (!$natent['dstport'])
413 a539f08b Bill Marquette
                          echo "*";
414
                      else
415 a88aca62 Scott Ullrich
                          echo $natent['dstport'];
416 a539f08b Bill Marquette
                    ?>
417
                  </td>
418 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
419 5b237745 Scott Ullrich
                    <?php
420 9250baaf PiBa-NL
					if (isset($natent['nonat']))
421
						echo '<I>NO NAT</I>';
422
					elseif (!$natent['target'])
423 2909d891 PiBa-NL
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
424 9250baaf PiBa-NL
					elseif ($natent['target'] == "other-subnet")
425
						echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
426
					else
427
						echo $natent['target'];
428 5b237745 Scott Ullrich
                    ?>
429
                  </td>
430 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
431 4d38bfc3 Scott Ullrich
                    <?php
432 3af33993 Scott Ullrich
                      if (!$natent['natport'])
433 4d38bfc3 Scott Ullrich
                          echo "*";
434
                      else
435 3af33993 Scott Ullrich
                          echo $natent['natport'];
436
                    ?>
437 5d8b0205 Scott Ullrich
                  </td>
438 1d89d699 Colin Fleming
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';" align="center">
439 5d8b0205 Scott Ullrich
                    <?php
440 b6905de8 Scott Ullrich
			if(isset($natent['staticnatport']))
441 1d89d699 Colin Fleming
			    echo gettext("YES");
442 b6905de8 Scott Ullrich
			else
443 1d89d699 Colin Fleming
			    echo gettext("NO");
444 5d8b0205 Scott Ullrich
                    ?>		    
445 4d38bfc3 Scott Ullrich
                  </td>
446 1d89d699 Colin Fleming
                  <td class="listbg" onclick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
447 64286300 Scott Ullrich
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
448 5b237745 Scott Ullrich
                  </td>
449 1d89d699 Colin Fleming
                  <td class="list nowrap" valign="middle">
450
                    <table border="0" cellspacing="0" cellpadding="1" summary="move">
451 9c96aff5 Bill Marquette
                      <tr>
452 1d89d699 Colin Fleming
                        <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");?>" type="image" style="height:17;width:17;border:0" /></td>
453
                        <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");?>" alt="edit" /></a></td>
454 9c96aff5 Bill Marquette
                      </tr>
455
                      <tr>
456 1d89d699 Colin Fleming
			<td align="center" valign="middle"><a href="firewall_nat_out.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule");?>" alt="delete" /></a></td>
457 ec532672 Chris Buechler
                        <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" alt="duplicate" /></a></td>
458 9c96aff5 Bill Marquette
                      </tr>
459
                    </table>
460
              <?php $i++; $nnats++; endforeach; ?>
461 19ae0929 Scott Ullrich
                <tr>
462 3af33993 Scott Ullrich
                  <td class="list" colspan="11"></td>
463 1d89d699 Colin Fleming
                  <td class="list nowrap" valign="middle">
464
                    <table border="0" cellspacing="0" cellpadding="1" summary="edit">
465 9c96aff5 Bill Marquette
                      <tr>
466 1d89d699 Colin Fleming
                        <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" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17;border:0" title="<?=gettext("move selected mappings to end");?>" /><?php endif; ?></td>
467
                        <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");?>" alt="add" /></a></td>
468 9c96aff5 Bill Marquette
                      </tr>
469
                      <tr>
470 1d89d699 Colin Fleming
                        <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" alt="delete" /><?php else: ?><input name="del" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="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>
471 9c96aff5 Bill Marquette
                      </tr>
472
                    </table></td>
473 5b237745 Scott Ullrich
                </tr>
474 d5475741 Scott Ullrich
                <tr>
475
                  <td colspan="12">
476 1d89d699 Colin Fleming
			<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br/>
477 64d42525 jim-p
			</strong></span>
478
			<?=gettext("With automatic outbound NAT enabled, a mapping is automatically created " .
479
			"for each interface's subnet (except WAN-type connections) and the rules " .
480
			"on this page are ignored.<br/><br/> " .
481
			"If manual outbound NAT is enabled, outbound NAT rules will not be " .
482
			"automatically generated and only the mappings you specify on this page " .
483
			"will be used. <br/><br/> " .
484
			"If a target address other than a WAN-type interface's IP address is used, " .
485 d0404e46 jim-p
			"then depending on the way the WAN connection is setup, a "); ?>
486
			<a href="firewall_virtual_ip.php"><?=gettext("Virtual IP"); ?></a>
487 5a8a7545 jim-p
			<?= gettext(" may also be required.") ?>
488
			<br/><br/>
489
			<?= gettext("To completely disable outbound NAT, switch to Manual Outbound NAT then delete any " .
490 1d89d699 Colin Fleming
			"NAT rules that appear in the list.") ?></span></p>
491 d5475741 Scott Ullrich
                    </td>
492
                </tr>
493
494 5b237745 Scott Ullrich
              </table>
495 d732f186 Bill Marquette
	    </div>
496 5b237745 Scott Ullrich
</td>
497
  </tr>
498
</table>
499
            </form>
500
<?php include("fend.inc"); ?>
501
</body>
502
</html>