diff options
author | Phil Davis <phil.davis@inf.org> | 2017-03-27 22:42:34 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2017-03-27 22:42:34 +0545 |
commit | fe108b671d09cf34a11270e286dcd4c4ce1c0597 (patch) | |
tree | 890d59078dda0ebee40351b91f292ebb5fe0907a /src/etc | |
parent | 593e9fe32d2959cd823fe5da55714ccfb9a0e958 (diff) | |
download | pfsense-fe108b671d09cf34a11270e286dcd4c4ce1c0597.zip pfsense-fe108b671d09cf34a11270e286dcd4c4ce1c0597.tar.gz |
Refactor is_port_or functions
Diffstat (limited to 'src/etc')
-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 6eb288d..74ffd9f 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1129,8 +1129,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)) { @@ -1141,15 +1141,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 */ |