summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/firewall_rules_edit.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-11-13 23:34:42 +0545
committerRenato Botelho <renato@netgate.com>2016-11-25 14:47:27 -0200
commit578083673518be2032196c6c39b5ebeb5c1b0312 (patch)
tree27020221e6d1e53bd6e5d6bdf9165beca6f4de05 /src/usr/local/www/firewall_rules_edit.php
parentfbcdf576d8fc3d0370f6082d38e87353f7ea1ccc (diff)
downloadpfsense-578083673518be2032196c6c39b5ebeb5c1b0312.zip
pfsense-578083673518be2032196c6c39b5ebeb5c1b0312.tar.gz
Keep the rule type selection after input errors on firewall rule
If the user: a) Edit a firewall rule b) Select "single host or alias" c) Enter an invalid IP address that is not an alias d) Press "Save" The error is displayed "1.2.3.999 is not a valid source IP address or alias" But note that the rule type dropdown has changed to "Network". In the case where there is $_POST data, we do not want to try and deduce the srctype or dsttype from the IP address in the src or dst field, because the value of that field could be the very invalid data that the user entered. We want to maintain the value of srctype or dsttype that the user selected and let them correct the error they made in typing the actual IP address. (cherry picked from commit 38ce4a18324aaceb76a976d08d0015bdc5be8bf7)
Diffstat (limited to 'src/usr/local/www/firewall_rules_edit.php')
-rw-r--r--src/usr/local/www/firewall_rules_edit.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index d025bf2..1ead8a5 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -1302,7 +1302,10 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) {
// The rule type dropdown on the GUI can be one of the special names like
// "any" "LANnet" "LAN address"... or "Single host or alias" or "Network"
- if (is_specialnet($pconfig[$type])) {
+ if ($pconfig[$type.'type']) {
+ // The rule type came from the $_POST array, after input errors, so keep it.
+ $ruleType = $pconfig[$type.'type'];
+ } elseif (is_specialnet($pconfig[$type])) {
// It is one of the special names, let it through as-is.
$ruleType = $pconfig[$type];
} elseif ((is_ipaddrv6($pconfig[$type]) && $pconfig[$type.'mask'] == 128) ||
OpenPOWER on IntegriCloud