Project

General

Profile

Download (21.9 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="firwall 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
?>
326
				<tr valign="top" id="fr<?=$i;?>">
327
					<td class="listt">
328
						<input type="checkbox" id="frc<?=$i;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$i;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
329
					</td>
330
					<td class="listt" align="center">
331
<?php
332
						$iconfn = "pass";
333
						if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) {
334
							$textss = "<span class=\"gray\">";
335
							$textse = "</span>";
336
							$iconfn .= "_d";
337
						} else {
338
							$textss = $textse = "";
339
						}
340

    
341
						if ($mode == "disabled" || $mode == "automatic"):
342
?>
343
							<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("This rule is being ignored");?>" alt="icon" />
344
<?php
345
						else:
346
?>
347
							<a href="?act=toggle&amp;id=<?=$i;?>">
348
								<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" 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 htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
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
						<?=$natent['source']['network'];?>
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 ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
364
						if (!$natent['sourceport'])
365
							echo "*";
366
						else
367
							echo $natent['sourceport'];
368
?>
369
					</td>
370
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
371
<?php
372
						if (isset($natent['destination']['any']))
373
							echo "*";
374
						else {
375
							if (isset($natent['destination']['not']))
376
								echo "!&nbsp;";
377
							echo $natent['destination']['address'];
378
						}
379
?>
380
					</td>
381
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
382
<?php
383
						echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
384
						if (!$natent['dstport'])
385
							echo "*";
386
						else
387
							echo $natent['dstport'];
388
?>
389
					</td>
390
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
391
<?php
392
						if (isset($natent['nonat']))
393
							echo '<I>NO NAT</I>';
394
						elseif (!$natent['target'])
395
							echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
396
						elseif ($natent['target'] == "other-subnet")
397
							echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
398
						else
399
							echo $natent['target'];
400
?>
401
					</td>
402
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
403
<?php
404
						if (!$natent['natport'])
405
							echo "*";
406
						else
407
							echo $natent['natport'];
408
?>
409
					</td>
410
					<td class="listr" onclick="fr_toggle(<?=$i;?>)" id="frd<?=$i;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';" align="center">
411
<?php
412
						if(isset($natent['staticnatport']))
413
							echo gettext("YES");
414
						else
415
							echo gettext("NO");
416
?>
417
					</td>
418
					<td class="listbg" onclick="fr_toggle(<?=$i;?>)" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
419
						<?=htmlspecialchars($natent['descr']);?>&nbsp;
420
					</td>
421
					<td class="list nowrap" valign="middle">
422
						<table border="0" cellspacing="0" cellpadding="1" summary="move">
423
							<tr>
424
								<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>
425
								<td>
426
									<a href="firewall_nat_out_edit.php?id=<?=$i;?>">
427
										<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit mapping");?>" alt="edit" />
428
									</a>
429
								</td>
430
							</tr>
431
							<tr>
432
								<td align="center" valign="middle">
433
									<a href="firewall_nat_out.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')">
434
										<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule");?>" alt="delete" />
435
									</a>
436
								</td>
437
								<td>
438
									<a href="firewall_nat_out_edit.php?dup=<?=$i;?>">
439
										<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" />
440
									</a>
441
								</td>
442
							</tr>
443
						</table>
444
					</td>
445
				</tr>
446
<?php
447
				$i++;
448
			endforeach;
449
?>
450
				<tr>
451
					<td class="list" colspan="11"></td>
452
					<td class="list nowrap" valign="middle">
453
						<table border="0" cellspacing="0" cellpadding="1" summary="edit">
454
							<tr>
455
								<td>
456
<?php
457
								if ($i == 0):
458
?>
459
									<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" />
460
<?php
461
								else:
462
?>
463
									<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");?>" />
464
<?php
465
								endif;
466
?>
467
								</td>
468
								<td>
469
									<a href="firewall_nat_out_edit.php">
470
										<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" />
471
									</a>
472
								</td>
473
							</tr>
474
							<tr>
475
								<td>
476
<?php
477
								if ($i == 0):
478
?>
479
									<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0" alt="delete" />
480
<?php
481
								else:
482
?>
483
									<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?");?>')" />
484
<?php
485
								endif;
486
?>
487
								</td>
488
							</tr>
489
						</table>
490
					</td>
491
				</tr>
492
<?php
493
			if ($mode == "automatic" || $mode == "hybrid"):
494
				if(empty($FilterIflist))
495
					filter_generate_optcfg_array();
496
				$automatic_rules = filter_nat_rules_outbound_automatic(implode(" ", filter_nat_rules_automatic_tonathosts()));
497
?>
498
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Automatic rules:"); ?></b></td></tr>
499
				<tr><td>&nbsp;</td></tr>
500
				<tr id="frheader">
501
					<td width="3%" class="list">&nbsp;</td>
502
					<td width="3%" class="list">&nbsp;</td>
503
					<td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
504
					<td width="15%" class="listhdrr"><?=gettext("Source");?></td>
505
					<td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
506
					<td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
507
					<td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
508
					<td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
509
					<td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
510
					<td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
511
					<td width="25%" class="listhdr"><?=gettext("Description");?></td>
512
					<td width="5%" class="list">&nbsp;</td>
513
				</tr>
514
<?php
515
				foreach ($automatic_rules as $natent):
516
?>
517
					<tr valign="top">
518
						<td class="list">&nbsp;</td>
519
						<td class="listt" align="center">
520
							<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0" title="<?=gettext("automatic outbound nat");?>" alt="icon" />
521
						</td>
522
						<td class="listlr" style="background-color: #E0E0E0">
523
							<?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
524
							&nbsp;
525
						</td>
526
						<td class="listr" style="background-color: #E0E0E0">
527
							<?=$natent['source']['network'];?>
528
						</td>
529
						<td class="listr" style="background-color: #E0E0E0">
530
<?php
531
							echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
532
							if (!$natent['sourceport'])
533
								echo "*";
534
							else
535
								echo $natent['sourceport'];
536
?>
537
						</td>
538
						<td class="listr" style="background-color: #E0E0E0">
539
<?php
540
							if (isset($natent['destination']['any']))
541
								echo "*";
542
							else {
543
								if (isset($natent['destination']['not']))
544
									echo "!&nbsp;";
545
								echo $natent['destination']['address'];
546
							}
547
?>
548
						</td>
549
						<td class="listr" style="background-color: #E0E0E0">
550
<?php
551
							echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
552
							if (!$natent['dstport'])
553
								echo "*";
554
							else
555
								echo $natent['dstport'];
556
?>
557
						</td>
558
						<td class="listr" style="background-color: #E0E0E0">
559
<?php
560
							if (isset($natent['nonat']))
561
								echo '<I>NO NAT</I>';
562
							elseif (!$natent['target'])
563
								echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
564
							elseif ($natent['target'] == "other-subnet")
565
								echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
566
							else
567
								echo $natent['target'];
568
?>
569
						</td>
570
						<td class="listr" style="background-color: #E0E0E0">
571
<?php
572
							if (!$natent['natport'])
573
								echo "*";
574
							else
575
								echo $natent['natport'];
576
?>
577
						</td>
578
						<td class="listr" style="background-color: #E0E0E0">
579
<?php
580
							if(isset($natent['staticnatport']))
581
								echo gettext("YES");
582
							else
583
								echo gettext("NO");
584
?>
585
						</td>
586
						<td class="listbg">
587
							<?=htmlspecialchars($natent['descr']);?>&nbsp;
588
						</td>
589
						<td class="list">&nbsp;</td>
590
					</tr>
591
<?php
592
				endforeach;
593
			endif;
594
?>
595
				<tr>
596
					<td colspan="12">
597
						<p><span class="vexpl">
598
							<span class="red"><strong><?=gettext("Note:"); ?><br/></strong></span>
599
							<?=gettext("If automatic outbound NAT selected, a mapping is automatically created " .
600
								"for each interface's subnet (except WAN-type connections) and the rules " .
601
								"on \"Mappings\" section of this page are ignored.<br/><br/> " .
602
								"If manual outbound NAT is selected, outbound NAT rules will not be " .
603
								"automatically generated and only the mappings you specify on this page " .
604
								"will be used. <br/><br/> " .
605
								"If hybrid outbound NAT is selected, mappings you specify on this page will " .
606
								"be used, followed by the automatically generated ones. <br/><br/>" .
607
								"If disable outbound NAT is selected, no rules will be used. <br/><br/>" .
608
								"If a target address other than a WAN-type interface's IP address is used, " .
609
								"then depending on the way the WAN connection is setup, a "); ?>
610
								<a href="firewall_virtual_ip.php"><?=gettext("Virtual IP"); ?></a>
611
								<?= gettext(" may also be required.") ?>
612
						</span></p>
613
					</td>
614
				</tr>
615
			</table>
616
			</div>
617
		</td>
618
	</tr>
619
</table>
620
</form>
621
<?php include("fend.inc"); ?>
622
</body>
623
</html>
(67-67/246)