Project

General

Profile

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