Project

General

Profile

Download (23.1 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
				//build Alias popup box
334
				$alias_src_span_begin = "";
335
				$alias_src_port_span_begin = "";
336
				$alias_dst_span_begin = "";
337
				$alias_dst_port_span_begin = "";
338

    
339
				$alias_popup = rule_popup($natent['source']['network'],pprint_port($natent['sourceport']),$natent['destination']['address'],pprint_port($natent['dstport']));
340

    
341
				$alias_src_span_begin = $alias_popup["src"];
342
				$alias_src_port_span_begin = $alias_popup["srcport"];
343
				$alias_dst_span_begin = $alias_popup["dst"];
344
				$alias_dst_port_span_begin = $alias_popup["dstport"];
345

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