From 9be373ff759efbebb0af8056d603c832bbbe4c9d Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 25 Oct 2018 09:10:31 +0200 Subject: [PATCH] Extend source address dropdown with specialnets, https://github.com/opnsense/core/issues/2837 --- src/www/firewall_nat_out.php | 2 ++ src/www/firewall_nat_out_edit.php | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/www/firewall_nat_out.php b/src/www/firewall_nat_out.php index 3c25e769e..c8bb2a9c8 100644 --- a/src/www/firewall_nat_out.php +++ b/src/www/firewall_nat_out.php @@ -388,6 +388,8 @@ include("head.inc"); title="" data-toggle="tooltip"> + +   diff --git a/src/www/firewall_nat_out_edit.php b/src/www/firewall_nat_out_edit.php index 624f8a27a..540688347 100644 --- a/src/www/firewall_nat_out_edit.php +++ b/src/www/firewall_nat_out_edit.php @@ -168,9 +168,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } - if (!(in_array($pconfig['source'], array("any","(self)")) || is_ipaddroralias($pconfig['source']))) { - $input_errors[] = gettext("A valid source must be specified."); + if (!is_specialnet($pconfig['source']) && !is_ipaddroralias($pconfig['source'])) { + $input_errors[] = sprintf(gettext("%s is not a valid source IP address or alias."), $pconfig['source']); } + if (!empty($pconfig['source_subnet']) && !is_numericint($pconfig['source_subnet'])) { $input_errors[] = gettext("A valid source bit count must be specified."); } @@ -262,7 +263,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $natent['source']['network'] = "any"; } else if($pconfig['source'] == "(self)") { $natent['source']['network'] = "(self)"; - } else if(is_alias($pconfig['source'])) { + } else if(is_alias($pconfig['source']) || is_specialnet($pconfig['source'])) { $natent['source']['network'] = trim($pconfig['source']); } else { if (is_ipaddrv6($pconfig['source'])) { @@ -491,14 +492,18 @@ include("head.inc");