diff options
author | Phil Davis <phil.davis@inf.org> | 2017-03-27 22:42:34 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-03-27 14:44:07 -0300 |
commit | eb104fc7bde22f5411ddec76e347b8151d0e7953 (patch) | |
tree | 0f118a19ddf80aded72ae4ea1802c6ef4f8384da | |
parent | 47b9112718f31e697a24fd0e22aaff988a912cfd (diff) | |
download | pfsense-eb104fc7bde22f5411ddec76e347b8151d0e7953.zip pfsense-eb104fc7bde22f5411ddec76e347b8151d0e7953.tar.gz |
Refactor is_port_or functions
(cherry picked from commit fe108b671d09cf34a11270e286dcd4c4ce1c0597)
-rw-r--r-- | src/etc/inc/util.inc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 2e0bf62..3dd5e5b 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1166,8 +1166,8 @@ function is_port_or_range($port) { return (is_port($port) || is_portrange($port)); } -/* returns true if $port is a valid port number or an alias thereof */ -function is_port_or_alias($port) { +/* returns true if $port is an alias that is a port type */ +function is_portalias($port) { global $config; if (is_alias($port)) { @@ -1178,15 +1178,18 @@ function is_port_or_alias($port) { } } } - return false; - } else { - return is_port($port); } + return false; +} + +/* returns true if $port is a valid port number or an alias thereof */ +function is_port_or_alias($port) { + return (is_port($port) || is_portalias($port)); } /* returns true if $port is a valid TCP/UDP port number or range ("<port>:<port>") or an alias thereof */ function is_port_or_range_or_alias($port) { - return (is_port_or_alias($port) || is_portrange($port)); + return (is_port($port) || is_portrange($port) || is_portalias($port)); } /* create ranges of sequential port numbers (200:215) and remove duplicates */ |