summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/util.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc/util.inc')
-rw-r--r--src/etc/inc/util.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index 4440bdc..76410b4 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -1124,6 +1124,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;
@@ -1142,6 +1147,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)) {
@@ -1781,7 +1791,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;
OpenPOWER on IntegriCloud