diff options
-rw-r--r-- | etc/inc/util.inc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index c3ec285..b134be0 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -434,6 +434,13 @@ function ip_range_to_subnet_array($startip, $endip) { return array(); } + if (ip_greater_than($startip, $endip)) { + // Swap start and end so we can process sensibly. + $temp = $startip; + $startip = $endip; + $endip = $temp; + } + // Container for subnets within this range. $rangesubnets = array(); @@ -473,7 +480,7 @@ function ip_range_to_subnet_array($startip, $endip) { } } - // Some logic that will recursivly search from $startip to the first IP before the start of the subnet we just found. + // Some logic that will recursively search from $startip to the first IP before the start of the subnet we just found. // NOTE: This may never be hit, the way the above algo turned out, but is left for completeness. if ($startip != $targetsub_min) { $rangesubnets = array_merge($rangesubnets, ip_range_to_subnet_array($startip, ip_before($targetsub_min))); |