summaryrefslogtreecommitdiffstats
path: root/usr/local/www/firewall_nat_1to1_edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www/firewall_nat_1to1_edit.php')
-rwxr-xr-xusr/local/www/firewall_nat_1to1_edit.php27
1 files changed, 14 insertions, 13 deletions
diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php
index 199adef..b6a307a 100755
--- a/usr/local/www/firewall_nat_1to1_edit.php
+++ b/usr/local/www/firewall_nat_1to1_edit.php
@@ -131,22 +131,25 @@ if ($_POST) {
$_POST['dsttype'] = "single";
}
- if (($_POST['external'] && !is_ipaddroralias($_POST['external'])))
+ /* For external, user can enter only ip's */
+ if (($_POST['external'] && !is_ipaddr($_POST['external'])))
$input_errors[] = gettext("A valid external subnet must be specified.");
- /* if user enters an alias and selects "network" then disallow. */
- if( ($_POST['srctype'] == "network" && is_alias($_POST['src']) )
- || ($_POST['dsttype'] == "network" && is_alias($_POST['dst']) ) )
+ /* For dst, if user enters an alias and selects "network" then disallow. */
+ if ($_POST['dsttype'] == "network" && is_alias($_POST['dst']) )
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
+ /* For src, user can enter only ip's or networks */
if (!is_specialnet($_POST['srctype'])) {
- if (($_POST['src'] && !is_ipaddroralias($_POST['src']))) {
- $input_errors[] = sprintf(gettext("%s is not a valid source IP address or alias."), $_POST['src']);
+ if (($_POST['src'] && !is_ipaddr($_POST['src']))) {
+ $input_errors[] = sprintf(gettext("%s is not a valid internal IP address."), $_POST['src']);
}
if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
- $input_errors[] = gettext("A valid source bit count must be specified.");
+ $input_errors[] = gettext("A valid internal bit count must be specified.");
}
}
+
+ /* For dst, user can enter ip's, networks or aliases */
if (!is_specialnet($_POST['dsttype'])) {
if (($_POST['dst'] && !is_ipaddroralias($_POST['dst']))) {
$input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."), $_POST['dst']);
@@ -309,12 +312,12 @@ function typesel_change() {
<td width="78%" class="vtable">
<input name="external" type="text" class="formfldalias" id="external" size="20" value="<?=htmlspecialchars($pconfig['external']);?>">
<br/>
- <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 source address below will be applied to this IP address."); ?><br>
+ <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>
<?=gettext("Hint: this is generally an address owned by the router itself on the selected interface."); ?></span>
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Source"); ?></td>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Internal IP"); ?></td>
<td width="78%" class="vtable">
<input name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>>
<strong><?=gettext("not"); ?></strong>
@@ -330,7 +333,7 @@ function typesel_change() {
<?php
$sel = is_specialnet($pconfig['src']); ?>
<option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>><?=gettext("any"); ?></option>
- <option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>><?=gettext("Single host"); ?></option>
+ <option value="single" <?php if ((($pconfig['srcmask'] == 32) || !isset($pconfig['srcmask'])) && !$sel) { echo "selected"; $sel = 1; } ?>><?=gettext("Single host"); ?></option>
<option value="network" <?php if (!$sel) echo "selected"; ?>><?=gettext("Network"); ?></option>
<?php if(have_ruleint_access("pptp")): ?>
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>><?=gettext("PPTP clients"); ?></option>
@@ -481,9 +484,7 @@ if($config['aliases']['alias'] <> "")
<!--
var addressarray=new Array(<?php echo $aliasesaddr; ?>);
- var oTextbox1 = new AutoSuggestControl(document.getElementById("external"), new StateSuggestions(addressarray));
- var oTextbox2 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
- var oTextbox3 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
+ var oTextbox1 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
//-->
</script>
<?php include("fend.inc"); ?>
OpenPOWER on IntegriCloud