diff options
author | Renato Botelho <renato@netgate.com> | 2016-08-01 18:35:23 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-08-01 18:35:23 -0300 |
commit | 3d3afbff80a02b9ad6f9df0bc44cc4d85b46f9e4 (patch) | |
tree | 0ff65e5d0a3c58e20cd96715a63b7534a1d2f452 | |
parent | 52342bc49e71d186f308d81dc23b87360c6d03ed (diff) | |
parent | f24e175eeb3406ed392b2889c8ba2173c9fa91e2 (diff) | |
download | pfsense-3d3afbff80a02b9ad6f9df0bc44cc4d85b46f9e4.zip pfsense-3d3afbff80a02b9ad6f9df0bc44cc4d85b46f9e4.tar.gz |
Merge pull request #3068 from phil-davis/subnet_size
-rw-r--r-- | src/etc/inc/util.inc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index e164881..e063d5d 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -838,12 +838,9 @@ function is_subnetoralias($subnet) { Returns 0 for bad data or if cannot represent size as an INT when $exact is set. */ function subnet_size($subnet, $exact=false) { $parts = explode("/", $subnet); - if (count($parts) == 2) { - if (is_ipaddrv4($parts[0])) { - return subnet_size_by_netmask(4, $parts[1], $exact); - } elseif (is_ipaddrv6($parts[0])) { - return subnet_size_by_netmask(6, $parts[1], $exact); - } + $iptype = is_ipaddr($parts[0]); + if (count($parts) == 2 && $iptype) { + return subnet_size_by_netmask($iptype, $parts[1], $exact); } return 0; } |