1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
firewall_nat_1to1_edit.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8
|
All rights reserved.
|
9
|
|
10
|
Redistribution and use in source and binary forms, with or without
|
11
|
modification, are permitted provided that the following conditions are met:
|
12
|
|
13
|
1. Redistributions of source code must retain the above copyright notice,
|
14
|
this list of conditions and the following disclaimer.
|
15
|
|
16
|
2. Redistributions in binary form must reproduce the above copyright
|
17
|
notice, this list of conditions and the following disclaimer in the
|
18
|
documentation and/or other materials provided with the distribution.
|
19
|
|
20
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
POSSIBILITY OF SUCH DAMAGE.
|
30
|
*/
|
31
|
/*
|
32
|
pfSense_MODULE: nat
|
33
|
*/
|
34
|
|
35
|
##|+PRIV
|
36
|
##|*IDENT=page-firewall-nat-1-1-edit
|
37
|
##|*NAME=Firewall: NAT: 1:1: Edit page
|
38
|
##|*DESCR=Allow access to the 'Firewall: NAT: 1:1: Edit' page.
|
39
|
##|*MATCH=firewall_nat_1to1_edit.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
function nat1to1cmp($a, $b) {
|
43
|
return ipcmp($a['external'], $b['external']);
|
44
|
}
|
45
|
|
46
|
function nat_1to1_rules_sort() {
|
47
|
global $g, $config;
|
48
|
|
49
|
if (!is_array($config['nat']['onetoone']))
|
50
|
return;
|
51
|
|
52
|
|
53
|
usort($config['nat']['onetoone'], "nat1to1cmp");
|
54
|
}
|
55
|
|
56
|
require("guiconfig.inc");
|
57
|
require_once("interfaces.inc");
|
58
|
require_once("filter.inc");
|
59
|
require("shaper.inc");
|
60
|
|
61
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
62
|
$ifdisp = get_configured_interface_with_descr();
|
63
|
foreach ($ifdisp as $kif => $kdescr) {
|
64
|
$specialsrcdst[] = "{$kif}";
|
65
|
$specialsrcdst[] = "{$kif}ip";
|
66
|
}
|
67
|
|
68
|
if (!is_array($config['nat']['onetoone'])) {
|
69
|
$config['nat']['onetoone'] = array();
|
70
|
}
|
71
|
$a_1to1 = &$config['nat']['onetoone'];
|
72
|
|
73
|
if (is_numericint($_GET['id']))
|
74
|
$id = $_GET['id'];
|
75
|
if (isset($_POST['id']) && is_numericint($_POST['id']))
|
76
|
$id = $_POST['id'];
|
77
|
|
78
|
if (isset($id) && $a_1to1[$id]) {
|
79
|
$pconfig['disabled'] = isset($a_1to1[$id]['disabled']);
|
80
|
|
81
|
address_to_pconfig($a_1to1[$id]['source'], $pconfig['src'],
|
82
|
$pconfig['srcmask'], $pconfig['srcnot'],
|
83
|
$pconfig['srcbeginport'], $pconfig['srcendport']);
|
84
|
|
85
|
address_to_pconfig($a_1to1[$id]['destination'], $pconfig['dst'],
|
86
|
$pconfig['dstmask'], $pconfig['dstnot'],
|
87
|
$pconfig['dstbeginport'], $pconfig['dstendport']);
|
88
|
|
89
|
$pconfig['interface'] = $a_1to1[$id]['interface'];
|
90
|
if (!$pconfig['interface'])
|
91
|
$pconfig['interface'] = "wan";
|
92
|
|
93
|
$pconfig['external'] = $a_1to1[$id]['external'];
|
94
|
$pconfig['descr'] = $a_1to1[$id]['descr'];
|
95
|
$pconfig['natreflection'] = $a_1to1[$id]['natreflection'];
|
96
|
} else
|
97
|
$pconfig['interface'] = "wan";
|
98
|
|
99
|
if ($_POST) {
|
100
|
|
101
|
unset($input_errors);
|
102
|
$pconfig = $_POST;
|
103
|
/* run through $_POST items encoding HTML entties so that the user
|
104
|
* cannot think he is slick and perform a XSS attack on the unwilling
|
105
|
*/
|
106
|
foreach ($_POST as $key => $value) {
|
107
|
$temp = str_replace(">", "", $value);
|
108
|
$newpost = htmlentities($temp);
|
109
|
if($newpost <> $temp)
|
110
|
$input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."),$temp);
|
111
|
}
|
112
|
|
113
|
/* input validation */
|
114
|
$reqdfields = explode(" ", "interface external");
|
115
|
$reqdfieldsn = array(gettext("Interface"), gettext("External subnet"));
|
116
|
if ($_POST['srctype'] == "single" || $_POST['srctype'] == "network") {
|
117
|
$reqdfields[] = "src";
|
118
|
$reqdfieldsn[] = gettext("Source address");
|
119
|
}
|
120
|
if ($_POST['dsttype'] == "single" || $_POST['dsttype'] == "network") {
|
121
|
$reqdfields[] = "dst";
|
122
|
$reqdfieldsn[] = gettext("Destination address");
|
123
|
}
|
124
|
|
125
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
126
|
|
127
|
if ($_POST['external'])
|
128
|
$_POST['external'] = trim($_POST['external']);
|
129
|
if ($_POST['src'])
|
130
|
$_POST['src'] = trim($_POST['src']);
|
131
|
if ($_POST['dst'])
|
132
|
$_POST['dst'] = trim($_POST['dst']);
|
133
|
|
134
|
if (is_specialnet($_POST['srctype'])) {
|
135
|
$_POST['src'] = $_POST['srctype'];
|
136
|
$_POST['srcmask'] = 0;
|
137
|
} else if ($_POST['srctype'] == "single") {
|
138
|
$_POST['srcmask'] = 32;
|
139
|
}
|
140
|
if (is_specialnet($_POST['dsttype'])) {
|
141
|
$_POST['dst'] = $_POST['dsttype'];
|
142
|
$_POST['dstmask'] = 0;
|
143
|
} else if ($_POST['dsttype'] == "single") {
|
144
|
$_POST['dstmask'] = 32;
|
145
|
} else if (is_ipaddr($_POST['dsttype'])) {
|
146
|
$_POST['dst'] = $_POST['dsttype'];
|
147
|
$_POST['dstmask'] = 32;
|
148
|
$_POST['dsttype'] = "single";
|
149
|
}
|
150
|
|
151
|
/* For external, user can enter only ip's */
|
152
|
if (($_POST['external'] && !is_ipaddr($_POST['external'])))
|
153
|
$input_errors[] = gettext("A valid external subnet must be specified.");
|
154
|
|
155
|
/* For dst, if user enters an alias and selects "network" then disallow. */
|
156
|
if ($_POST['dsttype'] == "network" && is_alias($_POST['dst']) )
|
157
|
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
|
158
|
|
159
|
/* For src, user can enter only ip's or networks */
|
160
|
if (!is_specialnet($_POST['srctype'])) {
|
161
|
if (($_POST['src'] && !is_ipaddr($_POST['src']))) {
|
162
|
$input_errors[] = sprintf(gettext("%s is not a valid internal IP address."), $_POST['src']);
|
163
|
}
|
164
|
if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
|
165
|
$input_errors[] = gettext("A valid internal bit count must be specified.");
|
166
|
}
|
167
|
}
|
168
|
|
169
|
/* For dst, user can enter ip's, networks or aliases */
|
170
|
if (!is_specialnet($_POST['dsttype'])) {
|
171
|
if (($_POST['dst'] && !is_ipaddroralias($_POST['dst']))) {
|
172
|
$input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."), $_POST['dst']);
|
173
|
}
|
174
|
if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
|
175
|
$input_errors[] = gettext("A valid destination bit count must be specified.");
|
176
|
}
|
177
|
}
|
178
|
|
179
|
/* check for overlaps with other 1:1 */
|
180
|
foreach ($a_1to1 as $natent) {
|
181
|
if (isset($id) && ($a_1to1[$id]) && ($a_1to1[$id] === $natent))
|
182
|
continue;
|
183
|
|
184
|
if (check_subnets_overlap($_POST['internal'], $_POST['subnet'], $natent['internal'], $natent['subnet'])) {
|
185
|
//$input_errors[] = "Another 1:1 rule overlaps with the specified internal subnet.";
|
186
|
//break;
|
187
|
}
|
188
|
}
|
189
|
|
190
|
if (!$input_errors) {
|
191
|
$natent = array();
|
192
|
|
193
|
$natent['disabled'] = isset($_POST['disabled']) ? true:false;
|
194
|
$natent['external'] = $_POST['external'];
|
195
|
$natent['descr'] = $_POST['descr'];
|
196
|
$natent['interface'] = $_POST['interface'];
|
197
|
|
198
|
pconfig_to_address($natent['source'], $_POST['src'],
|
199
|
$_POST['srcmask'], $_POST['srcnot']);
|
200
|
|
201
|
pconfig_to_address($natent['destination'], $_POST['dst'],
|
202
|
$_POST['dstmask'], $_POST['dstnot']);
|
203
|
|
204
|
if ($_POST['natreflection'] == "enable" || $_POST['natreflection'] == "disable")
|
205
|
$natent['natreflection'] = $_POST['natreflection'];
|
206
|
else
|
207
|
unset($natent['natreflection']);
|
208
|
|
209
|
if (isset($id) && $a_1to1[$id])
|
210
|
$a_1to1[$id] = $natent;
|
211
|
else
|
212
|
$a_1to1[] = $natent;
|
213
|
nat_1to1_rules_sort();
|
214
|
|
215
|
if (write_config())
|
216
|
mark_subsystem_dirty('natconf');
|
217
|
header("Location: firewall_nat_1to1.php");
|
218
|
exit;
|
219
|
}
|
220
|
}
|
221
|
|
222
|
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("1:1"),gettext("Edit"));
|
223
|
include("head.inc");
|
224
|
|
225
|
?>
|
226
|
|
227
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
228
|
<script type="text/javascript" src="/javascript/suggestions.js"></script>
|
229
|
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
|
230
|
<script type="text/javascript">
|
231
|
//<![CDATA[
|
232
|
function typesel_change() {
|
233
|
switch (document.iform.srctype.selectedIndex) {
|
234
|
case 1: /* single */
|
235
|
document.iform.src.disabled = 0;
|
236
|
document.iform.srcmask.value = "";
|
237
|
document.iform.srcmask.disabled = 1;
|
238
|
break;
|
239
|
case 2: /* network */
|
240
|
document.iform.src.disabled = 0;
|
241
|
document.iform.srcmask.disabled = 0;
|
242
|
break;
|
243
|
default:
|
244
|
document.iform.src.value = "";
|
245
|
document.iform.src.disabled = 1;
|
246
|
document.iform.srcmask.value = "";
|
247
|
document.iform.srcmask.disabled = 1;
|
248
|
break;
|
249
|
}
|
250
|
switch (document.iform.dsttype.selectedIndex) {
|
251
|
case 1: /* single */
|
252
|
document.iform.dst.disabled = 0;
|
253
|
document.iform.dstmask.value = "";
|
254
|
document.iform.dstmask.disabled = 1;
|
255
|
break;
|
256
|
case 2: /* network */
|
257
|
document.iform.dst.disabled = 0;
|
258
|
document.iform.dstmask.disabled = 0;
|
259
|
break;
|
260
|
default:
|
261
|
document.iform.dst.value = "";
|
262
|
document.iform.dst.disabled = 1;
|
263
|
document.iform.dstmask.value = "";
|
264
|
document.iform.dstmask.disabled = 1;
|
265
|
break;
|
266
|
}
|
267
|
}
|
268
|
//]]>
|
269
|
</script>
|
270
|
|
271
|
<?php include("fbegin.inc"); ?>
|
272
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
273
|
<form action="firewall_nat_1to1_edit.php" method="post" name="iform" id="iform">
|
274
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="firewall nat 1to1 edit">
|
275
|
<tr>
|
276
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit NAT 1:1 entry"); ?></td>
|
277
|
</tr>
|
278
|
<tr>
|
279
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
|
280
|
<td width="78%" class="vtable">
|
281
|
<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked=\"checked\""; ?> />
|
282
|
<strong><?=gettext("Disable this rule"); ?></strong><br />
|
283
|
<span class="vexpl"><?=gettext("Set this option to disable this rule without removing it from the list."); ?></span>
|
284
|
</td>
|
285
|
</tr>
|
286
|
<tr>
|
287
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
|
288
|
<td width="78%" class="vtable">
|
289
|
<select name="interface" class="formselect">
|
290
|
<?php
|
291
|
foreach ($ifdisp as $if => $ifdesc)
|
292
|
if(have_ruleint_access($if))
|
293
|
$interfaces[$if] = $ifdesc;
|
294
|
|
295
|
if ($config['l2tp']['mode'] == "server")
|
296
|
if(have_ruleint_access("l2tp"))
|
297
|
$interfaces['l2tp'] = "L2TP VPN";
|
298
|
|
299
|
if ($config['pptpd']['mode'] == "server")
|
300
|
if(have_ruleint_access("pptp"))
|
301
|
$interfaces['pptp'] = "PPTP VPN";
|
302
|
|
303
|
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
|
304
|
$interfaces['pppoe'] = "PPPoE VPN";
|
305
|
|
306
|
/* add ipsec interfaces */
|
307
|
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
|
308
|
if(have_ruleint_access("enc0"))
|
309
|
$interfaces["enc0"] = "IPsec";
|
310
|
|
311
|
/* add openvpn/tun interfaces */
|
312
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
|
313
|
$interfaces["openvpn"] = "OpenVPN";
|
314
|
|
315
|
foreach ($interfaces as $iface => $ifacename):
|
316
|
?>
|
317
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo " selected=\"selected\""; ?>>
|
318
|
<?=htmlspecialchars($ifacename);?>
|
319
|
</option>
|
320
|
<?php endforeach; ?>
|
321
|
</select><br/>
|
322
|
<span class="vexpl"><?=gettext("Choose which interface this rule applies to"); ?>.<br/>
|
323
|
<?=gettext("Hint: in most cases, you'll want to use WAN here"); ?>.</span></td>
|
324
|
</tr>
|
325
|
<tr>
|
326
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("External subnet IP"); ?></td>
|
327
|
<td width="78%" class="vtable">
|
328
|
<input name="external" type="text" class="formfld" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>" />
|
329
|
<br/>
|
330
|
<span class="vexpl"><?=gettext("Enter the external (usually on a WAN) subnet's starting address for the 1:1 mapping. The subnet mask from the internal address below will be applied to this IP address."); ?><br/>
|
331
|
<?=gettext("Hint: this is generally an address owned by the router itself on the selected interface."); ?></span>
|
332
|
</td>
|
333
|
</tr>
|
334
|
<tr>
|
335
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Internal IP"); ?></td>
|
336
|
<td width="78%" class="vtable">
|
337
|
<input name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked=\"checked\""; ?> />
|
338
|
<strong><?=gettext("not"); ?></strong>
|
339
|
<br />
|
340
|
<?=gettext("Use this option to invert the sense of the match."); ?>
|
341
|
<br />
|
342
|
<br />
|
343
|
<table border="0" cellspacing="0" cellpadding="0" summary="source">
|
344
|
<tr>
|
345
|
<td><?=gettext("Type:"); ?> </td>
|
346
|
<td>
|
347
|
<select name="srctype" class="formselect" onchange="typesel_change()">
|
348
|
<?php
|
349
|
$sel = is_specialnet($pconfig['src']); ?>
|
350
|
<option value="any" <?php if ($pconfig['src'] == "any") { echo " selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
|
351
|
<option value="single" <?php if ((($pconfig['srcmask'] == 32) || !isset($pconfig['srcmask'])) && !$sel) { echo " selected=\"selected\""; $sel = 1; } ?>><?=gettext("Single host"); ?></option>
|
352
|
<option value="network" <?php if (!$sel) echo " selected=\"selected\""; ?>><?=gettext("Network"); ?></option>
|
353
|
<?php if(have_ruleint_access("pptp")): ?>
|
354
|
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo " selected=\"selected\""; } ?>><?=gettext("PPTP clients"); ?></option>
|
355
|
<?php endif; ?>
|
356
|
<?php if(have_ruleint_access("pppoe")): ?>
|
357
|
<option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo " selected=\"selected\""; } ?>><?=gettext("PPPoE clients"); ?></option>
|
358
|
<?php endif; ?>
|
359
|
<?php if(have_ruleint_access("l2tp")): ?>
|
360
|
<option value="l2tp" <?php if ($pconfig['src'] == "l2tp") { echo " selected=\"selected\""; } ?>><?=gettext("L2TP clients"); ?></option>
|
361
|
<?php endif; ?>
|
362
|
<?php
|
363
|
foreach ($ifdisp as $ifent => $ifdesc): ?>
|
364
|
<?php if(have_ruleint_access($ifent)): ?>
|
365
|
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo " selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net"); ?></option>
|
366
|
<option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo " selected=\"selected\""; } ?>>
|
367
|
<?=$ifdesc?> <?=gettext("address");?>
|
368
|
</option>
|
369
|
<?php endif; endforeach; ?>
|
370
|
</select>
|
371
|
</td>
|
372
|
</tr>
|
373
|
<tr>
|
374
|
<td><?=gettext("Address:"); ?> </td>
|
375
|
<td>
|
376
|
<input name="src" type="text" class="formfld" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>" /> /
|
377
|
<select name="srcmask" class="formselect" id="srcmask">
|
378
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
379
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo " selected=\"selected\""; ?>><?=$i;?></option>
|
380
|
<?php endfor; ?>
|
381
|
</select>
|
382
|
</td>
|
383
|
</tr>
|
384
|
</table>
|
385
|
<br/>
|
386
|
<span class="vexpl"><?=gettext("Enter the internal (LAN) subnet for the 1:1 mapping. The subnet size specified for the internal subnet will be applied to the external subnet."); ?></span>
|
387
|
</td>
|
388
|
</tr>
|
389
|
<tr>
|
390
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Destination"); ?></td>
|
391
|
<td width="78%" class="vtable">
|
392
|
<input name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked=\"checked\""; ?> />
|
393
|
<strong><?=gettext("not"); ?></strong>
|
394
|
<br />
|
395
|
<?=gettext("Use this option to invert the sense of the match."); ?>
|
396
|
<br />
|
397
|
<br />
|
398
|
<table border="0" cellspacing="0" cellpadding="0" summary="destination">
|
399
|
<tr>
|
400
|
<td><?=gettext("Type:"); ?> </td>
|
401
|
<td>
|
402
|
<select name="dsttype" class="formselect" onchange="typesel_change()">
|
403
|
<?php
|
404
|
$sel = is_specialnet($pconfig['dst']); ?>
|
405
|
<option value="any" <?php if (empty($pconfig['dst']) || $pconfig['dst'] == "any") { echo " selected=\"selected\""; } ?>><?=gettext("any"); ?></option>
|
406
|
<option value="single" <?php if (($pconfig['dstmask'] == 32) && !$sel) { echo " selected=\"selected\""; $sel = 1; } ?>><?=gettext("Single host or alias"); ?></option>
|
407
|
<option value="network" <?php if (!$sel && !empty($pconfig['dst'])) echo " selected=\"selected\""; ?>><?=gettext("Network"); ?></option>
|
408
|
<?php if(have_ruleint_access("pptp")): ?>
|
409
|
<option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo " selected=\"selected\""; } ?>><?=gettext("PPTP clients"); ?></option>
|
410
|
<?php endif; ?>
|
411
|
<?php if(have_ruleint_access("pppoe")): ?>
|
412
|
<option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo " selected=\"selected\""; } ?>><?=gettext("PPPoE clients"); ?></option>
|
413
|
<?php endif; ?>
|
414
|
<?php if(have_ruleint_access("l2tp")): ?>
|
415
|
<option value="l2tp" <?php if ($pconfig['dst'] == "l2tp") { echo " selected=\"selected\""; } ?>><?=gettext("L2TP clients"); ?></option>
|
416
|
<?php endif; ?>
|
417
|
|
418
|
<?php foreach ($ifdisp as $if => $ifdesc): ?>
|
419
|
<?php if(have_ruleint_access($if)): ?>
|
420
|
<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo " selected=\"selected\""; } ?>><?=htmlspecialchars($ifdesc);?> <?=gettext("net"); ?></option>
|
421
|
<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo " selected=\"selected\""; } ?>>
|
422
|
<?=$ifdesc;?> <?=gettext("address");?>
|
423
|
</option>
|
424
|
<?php endif; endforeach; ?>
|
425
|
</select>
|
426
|
</td>
|
427
|
</tr>
|
428
|
<tr>
|
429
|
<td><?=gettext("Address:"); ?> </td>
|
430
|
<td>
|
431
|
<input name="dst" type="text" style="autocomplete:off" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>" />
|
432
|
/
|
433
|
<select name="dstmask" class="formselect" id="dstmask">
|
434
|
<?php
|
435
|
for ($i = 31; $i > 0; $i--): ?>
|
436
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo " selected=\"selected\""; ?>><?=$i;?></option>
|
437
|
<?php endfor; ?>
|
438
|
</select>
|
439
|
</td>
|
440
|
</tr>
|
441
|
</table>
|
442
|
<br/>
|
443
|
<span class="vexpl"><?=gettext("The 1:1 mapping will only be used for connections to or from the specified destination."); ?><br/>
|
444
|
<?=gettext("Hint: this is usually 'any'."); ?></span>
|
445
|
</td>
|
446
|
</tr>
|
447
|
<tr>
|
448
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
449
|
<td width="78%" class="vtable">
|
450
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
|
451
|
<br/> <span class="vexpl"><?=gettext("You may enter a description here " .
|
452
|
"for your reference (not parsed)."); ?></span></td>
|
453
|
</tr>
|
454
|
<tr>
|
455
|
<td width="22%" valign="top" class="vncell"><?=gettext("NAT reflection"); ?></td>
|
456
|
<td width="78%" class="vtable">
|
457
|
<select name="natreflection" class="formselect">
|
458
|
<option value="default" <?php if ($pconfig['natreflection'] != "enable" && $pconfig['natreflection'] != "disable") echo " selected=\"selected\""; ?>><?=gettext("use system default"); ?></option>
|
459
|
<option value="enable" <?php if ($pconfig['natreflection'] == "enable") echo " selected=\"selected\""; ?>><?=gettext("enable"); ?></option>
|
460
|
<option value="disable" <?php if ($pconfig['natreflection'] == "disable") echo " selected=\"selected\""; ?>><?=gettext("disable"); ?></option>
|
461
|
</select>
|
462
|
</td>
|
463
|
</tr>
|
464
|
<tr>
|
465
|
<td width="22%" valign="top"> </td>
|
466
|
<td width="78%">
|
467
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> <input type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()" />
|
468
|
<?php if (isset($id) && $a_1to1[$id]): ?>
|
469
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
|
470
|
<?php endif; ?>
|
471
|
</td>
|
472
|
</tr>
|
473
|
</table>
|
474
|
</form>
|
475
|
<script type="text/javascript">
|
476
|
//<![CDATA[
|
477
|
var autocomplete_off = ['dst'];
|
478
|
for (var i = 0; i < autocomplete_off.length; i++) {
|
479
|
var node = document.getElementById(autocomplete_off[i]);
|
480
|
node.setAttribute("autocomplete",node.style.autocomplete);
|
481
|
}
|
482
|
//]]>
|
483
|
</script>
|
484
|
<script type="text/javascript">
|
485
|
//<![CDATA[
|
486
|
typesel_change();
|
487
|
//]]>
|
488
|
</script>
|
489
|
<script type="text/javascript">
|
490
|
//<![CDATA[
|
491
|
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
|
492
|
var oTextbox1 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
|
493
|
//]]>
|
494
|
</script>
|
495
|
<?php include("fend.inc"); ?>
|
496
|
</body>
|
497
|
</html>
|