Project

General

Profile

« Previous | Next » 

Revision 57808367

Added by Phil Davis over 8 years ago

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)

View differences:

src/usr/local/www/firewall_rules_edit.php
1302 1302

  
1303 1303
	// The rule type dropdown on the GUI can be one of the special names like
1304 1304
	// "any" "LANnet" "LAN address"... or "Single host or alias" or "Network"
1305
	if (is_specialnet($pconfig[$type])) {
1305
	if ($pconfig[$type.'type']) {
1306
		// The rule type came from the $_POST array, after input errors, so keep it.
1307
		$ruleType = $pconfig[$type.'type'];
1308
	} elseif (is_specialnet($pconfig[$type])) {
1306 1309
		// It is one of the special names, let it through as-is.
1307 1310
		$ruleType = $pconfig[$type];
1308 1311
	} elseif ((is_ipaddrv6($pconfig[$type]) && $pconfig[$type.'mask'] == 128) ||

Also available in: Unified diff