firewall: make rule parsing more consistent as x:any and any:y are valid options, accepting literal "any" seems to make sense. closes https://github.com/opnsense/plugins/issues/2957

This commit is contained in:
Ad Schellevis 2022-04-25 18:08:00 +02:00
parent 43958b00cc
commit 9ff04d14b4

View File

@ -280,6 +280,8 @@ abstract class Rule
if (strpos($port, ':any') !== false xor strpos($port, 'any:') !== false) {
// convert 'any' to upper or lower bound when provided in range. e.g. 80:any --> 80:65535
$port = str_replace('any', strpos($port, ':any') !== false ? '65535' : '1', $port);
} elseif ($port == 'any') {
$port = null;
}
if (Util::isPort($port)) {
$rule[$target . "_port"] = $port;