Project

General

Profile

Download (22.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_nat_out.php
5
	Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7

    
8
	originally part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

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

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

    
18
	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

    
22
	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
/*
34
	pfSense_MODULE:	nat
35
*/
36

    
37
##|+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
require("guiconfig.inc");
45
require_once("functions.inc");
46
require_once("filter.inc");
47
require_once("shaper.inc");
48

    
49
global $FilterIflist;
50

    
51
if (!is_array($config['nat']['outbound']))
52
	$config['nat']['outbound'] = array();
53

    
54
if (!is_array($config['nat']['outbound']['rule']))
55
	$config['nat']['outbound']['rule'] = array();
56

    
57
$a_out = &$config['nat']['outbound']['rule'];
58

    
59
if (!isset($config['nat']['outbound']['mode']))
60
	$config['nat']['outbound']['mode'] = "automatic";
61

    
62
$mode = $config['nat']['outbound']['mode'];
63

    
64
if ($_POST['apply']) {
65
	write_config();
66

    
67
	$retval = 0;
68
	$retval |= filter_configure();
69

    
70
	if(stristr($retval, "error") <> true)
71
	        $savemsg = get_std_save_message($retval);
72
	else
73
		$savemsg = $retval;
74

    
75
	if ($retval == 0) {
76
		clear_subsystem_dirty('natconf');
77
		clear_subsystem_dirty('filter');
78
	}
79
}
80

    
81
if (isset($_POST['save']) && $_POST['save'] == "Save") {
82
	/* mutually exclusive settings - if user wants advanced NAT, we don't generate automatic rules */
83
	if ($_POST['mode'] == "advanced" && ($mode == "automatic" || $mode == "hybrid")) {
84
		/*
85
		 *    user has enabled advanced outbound NAT and doesn't have rules
86
		 *    lets automatically create entries
87
		 *    for all of the interfaces to make life easier on the pip-o-chap
88
		 */
89
		if(empty($FilterIflist))
90
			filter_generate_optcfg_array();
91
		$tonathosts = filter_nat_rules_automatic_tonathosts(true);
92
		$automatic_rules = filter_nat_rules_outbound_automatic("");
93

    
94
		foreach ($tonathosts as $tonathost) {
95
			foreach ($automatic_rules as $natent) {
96
				$natent['source']['network'] = $tonathost['subnet'];
97
				$natent['descr'] .= sprintf(gettext(' - %1$s to %2$s'),
98
					$tonathost['descr'],
99
					convert_real_interface_to_friendly_descr($natent['interface']));
100
				$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
101

    
102
				/* Try to detect already auto created rules and avoid duplicate them */
103
				$found = false;
104
				foreach ($a_out as $rule) {
105
					if ($rule['interface'] == $natent['interface'] &&
106
					    $rule['source']['network'] == $natent['source']['network'] &&
107
					    $rule['dstport'] == $natent['dstport'] &&
108
					    $rule['target'] == $natent['target'] &&
109
					    $rule['descr'] == $natent['descr']) {
110
						$found = true;
111
						break;
112
					}
113
				}
114

    
115
				if ($found === false)
116
					$a_out[] = $natent;
117
			}
118
		}
119
		$savemsg = gettext("Default rules for each interface have been created.");
120
	}
121

    
122
	$config['nat']['outbound']['mode'] = $_POST['mode'];
123

    
124
	if (write_config())
125
		mark_subsystem_dirty('natconf');
126
	header("Location: firewall_nat_out.php");
127
	exit;
128
}
129

    
130
if ($_GET['act'] == "del") {
131
	if ($a_out[$_GET['id']]) {
132
		unset($a_out[$_GET['id']]);
133
		if (write_config())
134
			mark_subsystem_dirty('natconf');
135
		header("Location: firewall_nat_out.php");
136
		exit;
137
	}
138
}
139

    
140
if (isset($_POST['del_x'])) {
141
	/* delete selected rules */
142
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
143
		foreach ($_POST['rule'] as $rulei) {
144
			unset($a_out[$rulei]);
145
		}
146
		if (write_config())
147
			mark_subsystem_dirty('natconf');
148
		header("Location: firewall_nat_out.php");
149
		exit;
150
	}
151

    
152
} else if ($_GET['act'] == "toggle") {
153
	if ($a_out[$_GET['id']]) {
154
		if(isset($a_out[$_GET['id']]['disabled']))
155
			unset($a_out[$_GET['id']]['disabled']);
156
		else
157
			$a_out[$_GET['id']]['disabled'] = true;
158
		if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule"))
159
			mark_subsystem_dirty('natconf');
160
		header("Location: firewall_nat_out.php");
161
		exit;
162
	}
163
} else {
164
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
165
	unset($movebtn);
166
	foreach ($_POST as $pn => $pd) {
167
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
168
			$movebtn = $matches[1];
169
			break;
170
		}
171
	}
172
	/* move selected rules before this rule */
173
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
174
		$a_out_new = array();
175

    
176
		/* copy all rules < $movebtn and not selected */
177
		for ($i = 0; $i < $movebtn; $i++) {
178
			if (!in_array($i, $_POST['rule']))
179
				$a_out_new[] = $a_out[$i];
180
		}
181

    
182
		/* copy all selected rules */
183
		for ($i = 0; $i < count($a_out); $i++) {
184
			if ($i == $movebtn)
185
				continue;
186
			if (in_array($i, $_POST['rule']))
187
				$a_out_new[] = $a_out[$i];
188
		}
189

    
190
		/* copy $movebtn rule */
191
		if ($movebtn < count($a_out))
192
			$a_out_new[] = $a_out[$movebtn];
193

    
194
		/* copy all rules > $movebtn and not selected */
195
		for ($i = $movebtn+1; $i < count($a_out); $i++) {
196
			if (!in_array($i, $_POST['rule']))
197
				$a_out_new[] = $a_out[$i];
198
		}
199
		if (count($a_out_new) > 0)
200
			$a_out = $a_out_new;
201

    
202
		if (write_config())
203
			mark_subsystem_dirty('natconf');
204
		header("Location: firewall_nat_out.php");
205
		exit;
206
	}
207
}
208

    
209
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
210
include("head.inc");
211

    
212
?>
213
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
214
<?php include("fbegin.inc"); ?>
215
<form action="firewall_nat_out.php" method="post" name="iform">
216
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js"></script>
217
<?php
218
if ($savemsg)
219
	print_info_box($savemsg);
220
if (is_subsystem_dirty('natconf'))
221
	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."));
222
?>
223
<br/>
224
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall nat outbound">
225
	<tr><td>
226
<?php
227
		$tab_array = array();
228
		$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
229
		$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
230
		$tab_array[] = array(gettext("Outbound"), true, "firewall_nat_out.php");
231
		$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
232
		display_top_tabs($tab_array);
233
?>
234
	</td></tr>
235
	<tr>
236
		<td>
237
			<div id="mainarea">
238
			<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
239
				<tr>
240
					<td rowspan="3" align="right" valign="middle"><b><?=gettext("Mode:"); ?></b></td>
241
					<td>
242
						<input name="mode" type="radio" id="automatic" value="automatic" <?php if ($mode == "automatic") echo "checked=\"checked\"";?> />
243
					</td>
244
					<td>
245
						<strong>
246
							<?=gettext("Automatic outbound NAT rule generation"); ?><br/>
247
							<?=gettext("(IPsec passthrough included)");?>
248
						</strong>
249
					</td>
250
					<td>
251
						<input name="mode" type="radio" id="hybrid" value="hybrid" <?php if ($mode == "hybrid") echo "checked=\"checked\"";?> />
252
					</td>
253
					<td>
254
						<strong>
255
							<?=gettext("Hybrid Outbound NAT rule generation"); ?><br/>
256
							<?=gettext("(Automatic Outbound NAT + rules below)");?>
257
						</strong>
258
					</td>
259
					<td rowspan="3" valign="middle" align="left">
260
						<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
261
					</td>
262
				</tr>
263
				<tr>
264
					<td colspan="4">
265
						&nbsp;
266
					</td>
267
				</tr>
268
				<tr>
269
					<td>
270
						<input name="mode" type="radio" id="advanced" value="advanced" <?php if ($mode == "advanced") echo "checked=\"checked\"";?> />
271
					</td>
272
					<td>
273
						<strong>
274
							<?=gettext("Manual Outbound NAT rule generation"); ?><br/>
275
							<?=gettext("(AON - Advanced Outbound NAT)");?>
276
						</strong>
277
					</td>
278
					<td>
279
						<input name="mode" type="radio" id="disabled" value="disabled" <?php if ($mode == "disabled") echo "checked=\"checked\"";?> />
280
					</td>
281
					<td>
282
						<strong>
283
							<?=gettext("Disable Outbound NAT rule generation"); ?><br/>
284
							<?=gettext("(No Outbound NAT rules)");?>
285
						</strong>
286
					</td>
287
				</tr>
288
				<tr>
289
					<td colspan="6">
290
						&nbsp;
291
					</td>
292
				</tr>
293
			</table>
294
			<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="mappings">
295
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Mappings:"); ?></b></td></tr>
296
				<tr><td>&nbsp;</td></tr>
297
				<tr id="frheader">
298
					<td width="3%" class="list">&nbsp;</td>
299
					<td width="3%" class="list">&nbsp;</td>
300
					<td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
301
					<td width="15%" class="listhdrr"><?=gettext("Source");?></td>
302
					<td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
303
					<td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
304
					<td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
305
					<td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
306
					<td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
307
					<td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
308
					<td width="25%" class="listhdr"><?=gettext("Description");?></td>
309
					<td width="5%" class="list">
310
						<table border="0" cellspacing="0" cellpadding="1" summary="add">
311
							<tr>
312
								<td width="17"></td>
313
								<td>
314
									<a href="firewall_nat_out_edit.php?after=-1">
315
										<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" />
316
									</a>
317
								</td>
318
							</tr>
319
						</table>
320
					</td>
321
				</tr>
322
<?php
323
			$i = 0;
324
			foreach ($a_out as $natent):
325
				$iconfn = "pass";
326
				$textss = $textse = "";
327
				if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) {
328
					$textss = "<span class=\"gray\">";
329
					$textse = "</span>";
330
					$iconfn .= "_d";
331
				}
332
?>
333
				<tr valign="top" id="fr<?=$i;?>">
334
					<td class="listt">
335
						<input type="checkbox" id="frc<?=$i;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
336
					</td>
337
					<td class="listt" align="center">
338
<?php
339
					if ($mode == "disabled" || $mode == "automatic"):
340
?>
341
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0"
342
							title="<?=gettext("This rule is being ignored");?>" alt="icon" />
343
<?php
344
					else:
345
?>
346
						<a href="?act=toggle&amp;id=<?=$i;?>">
347
							<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0"
348
								title="<?=gettext("click to toggle enabled/disabled status");?>" alt="icon" />
349
						</a>
350
<?php
351
						endif;
352
?>
353
					</td>
354
					<td class="listlr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
355
						<?php echo $textss . htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . $textse; ?>
356
						&nbsp;
357
					</td>
358
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
359
						<?php echo $textss . $natent['source']['network'] . $textse;?>
360
					</td>
361
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
362
<?php
363
						echo $textss;
364
						echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
365
						if (!$natent['sourceport'])
366
							echo "*";
367
						else
368
							echo $natent['sourceport'];
369
						echo $textse;
370
?>
371
					</td>
372
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
373
<?php
374
						echo $textss;
375
						if (isset($natent['destination']['any']))
376
							echo "*";
377
						else {
378
							if (isset($natent['destination']['not']))
379
								echo "!&nbsp;";
380
							echo $natent['destination']['address'];
381
						}
382
						echo $textse;
383
?>
384
					</td>
385
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
386
<?php
387
						echo $textss;
388
						echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
389
						if (!$natent['dstport'])
390
							echo "*";
391
						else
392
							echo $natent['dstport'];
393
						echo $textse;
394
?>
395
					</td>
396
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
397
<?php
398
						echo $textss;
399
						if (isset($natent['nonat']))
400
							echo '<I>NO NAT</I>';
401
						elseif (!$natent['target'])
402
							echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
403
						elseif ($natent['target'] == "other-subnet")
404
							echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
405
						else
406
							echo $natent['target'];
407
						echo $textse;
408
?>
409
					</td>
410
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
411
<?php
412
						echo $textss;
413
						if (!$natent['natport'])
414
							echo "*";
415
						else
416
							echo $natent['natport'];
417
						echo $textse;
418
?>
419
					</td>
420
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';" align="center">
421
<?php
422
						echo $textss;
423
						if(isset($natent['staticnatport']))
424
							echo gettext("YES");
425
						else
426
							echo gettext("NO");
427
						echo $textse;
428
?>
429
					</td>
430
					<td class="listbg" onclick="fr_toggle(<?=$i;?>)" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
431
						<?=htmlspecialchars($natent['descr']);?>&nbsp;
432
					</td>
433
					<td class="list nowrap" valign="middle">
434
						<table border="0" cellspacing="0" cellpadding="1" summary="move">
435
							<tr>
436
								<td><input onmouseover="fr_insline(<?=$i;?>, true)" onmouseout="fr_insline(<?=$i;?>, 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>
437
								<td>
438
									<a href="firewall_nat_out_edit.php?id=<?=$i;?>">
439
										<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit mapping");?>" alt="edit" />
440
									</a>
441
								</td>
442
							</tr>
443
							<tr>
444
								<td align="center" valign="middle">
445
									<a href="firewall_nat_out.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')">
446
										<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule");?>" alt="delete" />
447
									</a>
448
								</td>
449
								<td>
450
									<a href="firewall_nat_out_edit.php?dup=<?=$i;?>">
451
										<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" />
452
									</a>
453
								</td>
454
							</tr>
455
						</table>
456
					</td>
457
				</tr>
458
<?php
459
				$i++;
460
			endforeach;
461
?>
462
				<tr>
463
					<td class="list" colspan="11"></td>
464
					<td class="list nowrap" valign="middle">
465
						<table border="0" cellspacing="0" cellpadding="1" summary="edit">
466
							<tr>
467
								<td>
468
<?php
469
								if ($i == 0):
470
?>
471
									<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" />
472
<?php
473
								else:
474
?>
475
									<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");?>" />
476
<?php
477
								endif;
478
?>
479
								</td>
480
								<td>
481
									<a href="firewall_nat_out_edit.php">
482
										<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" />
483
									</a>
484
								</td>
485
							</tr>
486
							<tr>
487
								<td>
488
<?php
489
								if ($i == 0):
490
?>
491
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0" alt="delete" />
492
<?php
493
								else:
494
?>
495
									<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?");?>')" />
496
<?php
497
								endif;
498
?>
499
								</td>
500
							</tr>
501
						</table>
502
					</td>
503
				</tr>
504
<?php
505
			if ($mode == "automatic" || $mode == "hybrid"):
506
				if(empty($FilterIflist))
507
					filter_generate_optcfg_array();
508
				$automatic_rules = filter_nat_rules_outbound_automatic(implode(" ", filter_nat_rules_automatic_tonathosts()));
509
?>
510
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Automatic rules:"); ?></b></td></tr>
511
				<tr><td>&nbsp;</td></tr>
512
				<tr id="frheader">
513
					<td width="3%" class="list">&nbsp;</td>
514
					<td width="3%" class="list">&nbsp;</td>
515
					<td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
516
					<td width="15%" class="listhdrr"><?=gettext("Source");?></td>
517
					<td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
518
					<td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
519
					<td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
520
					<td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
521
					<td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
522
					<td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
523
					<td width="25%" class="listhdr"><?=gettext("Description");?></td>
524
					<td width="5%" class="list">&nbsp;</td>
525
				</tr>
526
<?php
527
				foreach ($automatic_rules as $natent):
528
?>
529
					<tr valign="top">
530
						<td class="list">&nbsp;</td>
531
						<td class="listt" align="center">
532
							<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0" title="<?=gettext("automatic outbound nat");?>" alt="icon" />
533
						</td>
534
						<td class="listlr" style="background-color: #E0E0E0">
535
							<?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
536
							&nbsp;
537
						</td>
538
						<td class="listr" style="background-color: #E0E0E0">
539
							<?=$natent['source']['network'];?>
540
						</td>
541
						<td class="listr" style="background-color: #E0E0E0">
542
<?php
543
							echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
544
							if (!$natent['sourceport'])
545
								echo "*";
546
							else
547
								echo $natent['sourceport'];
548
?>
549
						</td>
550
						<td class="listr" style="background-color: #E0E0E0">
551
<?php
552
							if (isset($natent['destination']['any']))
553
								echo "*";
554
							else {
555
								if (isset($natent['destination']['not']))
556
									echo "!&nbsp;";
557
								echo $natent['destination']['address'];
558
							}
559
?>
560
						</td>
561
						<td class="listr" style="background-color: #E0E0E0">
562
<?php
563
							echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
564
							if (!$natent['dstport'])
565
								echo "*";
566
							else
567
								echo $natent['dstport'];
568
?>
569
						</td>
570
						<td class="listr" style="background-color: #E0E0E0">
571
<?php
572
							if (isset($natent['nonat']))
573
								echo '<I>NO NAT</I>';
574
							elseif (!$natent['target'])
575
								echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
576
							elseif ($natent['target'] == "other-subnet")
577
								echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
578
							else
579
								echo $natent['target'];
580
?>
581
						</td>
582
						<td class="listr" style="background-color: #E0E0E0">
583
<?php
584
							if (!$natent['natport'])
585
								echo "*";
586
							else
587
								echo $natent['natport'];
588
?>
589
						</td>
590
						<td class="listr" style="background-color: #E0E0E0">
591
<?php
592
							if(isset($natent['staticnatport']))
593
								echo gettext("YES");
594
							else
595
								echo gettext("NO");
596
?>
597
						</td>
598
						<td class="listbg">
599
							<?=htmlspecialchars($natent['descr']);?>&nbsp;
600
						</td>
601
						<td class="list">&nbsp;</td>
602
					</tr>
603
<?php
604
				endforeach;
605
			endif;
606
?>
607
				<tr>
608
					<td colspan="12">
609
						<p><span class="vexpl">
610
							<span class="red"><strong><?=gettext("Note:"); ?><br/></strong></span>
611
							<?=gettext("If automatic outbound NAT selected, a mapping is automatically created " .
612
								"for each interface's subnet (except WAN-type connections) and the rules " .
613
								"on \"Mappings\" section of this page are ignored.<br/><br/> " .
614
								"If manual outbound NAT is selected, outbound NAT rules will not be " .
615
								"automatically generated and only the mappings you specify on this page " .
616
								"will be used. <br/><br/> " .
617
								"If hybrid outbound NAT is selected, mappings you specify on this page will " .
618
								"be used, followed by the automatically generated ones. <br/><br/>" .
619
								"If disable outbound NAT is selected, no rules will be used. <br/><br/>" .
620
								"If a target address other than a WAN-type interface's IP address is used, " .
621
								"then depending on the way the WAN connection is setup, a "); ?>
622
								<a href="firewall_virtual_ip.php"><?=gettext("Virtual IP"); ?></a>
623
								<?= gettext(" may also be required.") ?>
624
						</span></p>
625
					</td>
626
				</tr>
627
			</table>
628
			</div>
629
		</td>
630
	</tr>
631
</table>
632
</form>
633
<?php include("fend.inc"); ?>
634
</body>
635
</html>
(67-67/246)