diff --git a/src/www/firewall_nat_1to1_edit.php b/src/www/firewall_nat_1to1_edit.php index 3989ee79b..8530f0446 100644 --- a/src/www/firewall_nat_1to1_edit.php +++ b/src/www/firewall_nat_1to1_edit.php @@ -102,7 +102,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { /* For external, user can enter only ip's */ $tmpext = explode('/', $pconfig['external']); - //print_r($tmpext);echo $pconfig['srcmask'] ;die; if (!empty($pconfig['external'])) { if ($pconfig['type'] == 'binat' && (!is_ipaddr($tmpext[0]) || (count($tmpext) != 1 && $pconfig['srcmask'] != $tmpext[1]))) { $input_errors[] = gettext("A valid external subnet must be specified."); @@ -111,7 +110,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } /* For src, user can enter only ip's or networks */ - if (!is_specialnet($pconfig['src']) && !is_ipaddroralias($pconfig['src'])) { + if ($pconfig['type'] == 'binat' && !is_subnet($pconfig['src']) && !is_ipaddr($pconfig['src'])) { + $input_errors[] = sprintf(gettext("%s is not a valid source IP address."), $pconfig['src']); + } elseif (!is_specialnet($pconfig['src']) && !is_ipaddroralias($pconfig['src'])) { $input_errors[] = sprintf(gettext("%s is not a valid source IP address or alias."), $pconfig['src']); } if (!empty($pconfig['srcmask']) && !is_numericint($pconfig['srcmask'])) { @@ -210,6 +211,17 @@ include("head.inc"); } }); + // aliases and "special nets" are only allowed for nat type entries + $("#nattype").change(function(){ + if ($(this).val() == 'binat') { + $("#src optgroup[data-type='nat']").children().prop('disabled', true); + } else { + $("#src optgroup[data-type='nat']").children().prop('disabled', false); + } + $("#src").selectpicker('refresh'); + }); + $("#nattype").change(); + }); @@ -265,7 +277,7 @@ include("head.inc"); - @@ -306,15 +318,15 @@ include("head.inc");
- - "> + " data-type="nat"> - "> + " data-type="nat"> $ifdesc): ?>