summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-02-02 05:55:19 -0200
committerRenato Botelho <garga@FreeBSD.org>2015-02-02 05:55:19 -0200
commit2b8353ba39441311612c30e5e7c6e71643b07aa3 (patch)
treef94f4668e9ac7d77322e358d5c8d5b0b47840e44
parentb2b1822b97b8103fffee90d4ff0285e9d5ebc0d2 (diff)
parent7510623598e0adce183beabd6aa1ffeb0fde625b (diff)
downloadpfsense-2b8353ba39441311612c30e5e7c6e71643b07aa3.zip
pfsense-2b8353ba39441311612c30e5e7c6e71643b07aa3.tar.gz
Merge pull request #1459 from PiBa-NL/speedup_is_port
-rw-r--r--etc/inc/util.inc8
1 files changed, 3 insertions, 5 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 0e8ffe4..febed5d 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -836,13 +836,11 @@ function is_validaliasname($name) {
/* returns true if $port is a valid TCP/UDP port */
function is_port($port) {
+ if (ctype_digit($port) && ((intval($port) >= 1) && (intval($port) <= 65535)))
+ return true;
if (getservbyname($port, "tcp") || getservbyname($port, "udp"))
return true;
- if (!ctype_digit($port))
- return false;
- else if ((intval($port) < 1) || (intval($port) > 65535))
- return false;
- return true;
+ return false;
}
/* returns true if $portrange is a valid TCP/UDP portrange ("<port>:<port>") */
OpenPOWER on IntegriCloud