From fe108b671d09cf34a11270e286dcd4c4ce1c0597 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 27 Mar 2017 22:42:34 +0545 Subject: Refactor is_port_or functions --- src/etc/inc/util.inc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') 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 (":") 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 */ -- cgit v1.1