diff options
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r-- | src/etc/inc/util.inc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index e685c06..fb21396 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1161,6 +1161,11 @@ function is_portrange($portrange) { return (count($ports) == 2 && is_port($ports[0]) && is_port($ports[1])); } +/* returns true if $port is a valid TCP/UDP port number or range ("<port>:<port>") */ +function is_portorrange($port) { + return (is_port($port) || is_portrange($port)); +} + /* returns true if $port is a valid port number or an alias thereof */ function is_portoralias($port) { global $config; @@ -1179,6 +1184,11 @@ function is_portoralias($port) { } } +/* returns true if $port is a valid TCP/UDP port number or range ("<port>:<port>") or an alias thereof */ +function is_portorrangeoralias($port) { + return (is_portoralias($port) || is_portrange($port)); +} + /* create ranges of sequential port numbers (200:215) and remove duplicates */ function group_ports($ports, $kflc = false) { if (!is_array($ports) || empty($ports)) { @@ -1817,7 +1827,7 @@ function alias_expand($name) { } } return "\${$name}"; - } else if (is_ipaddr($name) || is_subnet($name) || is_port($name) || is_portrange($name)) { + } else if (is_ipaddr($name) || is_subnet($name) || is_portorrange($name)) { return "{$name}"; } else { return null; |