summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorWarren Baker <warren@decoy.co.za>2011-09-29 01:32:09 +0200
committerWarren Baker <warren@decoy.co.za>2011-09-29 01:32:09 +0200
commitb1b42a065cd5c6bf867d6a12371379ff2ddbed85 (patch)
tree5ece9f7ab7ceb6bbba6318c6874d54de420c3806 /etc
parentfdb9c1dbb63b93ed0230e66a79559cbdd3cb7943 (diff)
downloadpfsense-b1b42a065cd5c6bf867d6a12371379ff2ddbed85.zip
pfsense-b1b42a065cd5c6bf867d6a12371379ff2ddbed85.tar.gz
Combine is_subnet to check for both v4 and v6 subnets
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/util.inc13
1 files changed, 12 insertions, 1 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index b065868..1c52694 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -502,8 +502,19 @@ function is_ipaddroralias($ipaddr) {
}
-/* returns true if $subnet is a valid subnet in CIDR format */
+/* returns true if $subnet is a valid IPv4 or IPv6 subnet in CIDR format */
function is_subnet($subnet) {
+ if(is_subnetv4($subnet)) {
+ return true;
+ }
+ if(is_subnetv6($subnet)) {
+ return true;
+ }
+ return false;
+}
+
+/* returns true if $subnet is a valid IPv4 subnet in CIDR format */
+function is_subnetv4($subnet) {
if (!is_string($subnet))
return false;
OpenPOWER on IntegriCloud