mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Don't skip blocks if suffix size fits
This commit is contained in:
+6
-3
@@ -162,9 +162,12 @@ function CalculateNextAddressPrefix {
|
||||
$startIPAddress = $endIPAddress
|
||||
}
|
||||
}
|
||||
# round up to the next possible start for the given suffix size
|
||||
$suffixLength = 32 - $prefixLength
|
||||
$startIPAddress = (($startIPAddress -shr $suffixLength) + 1) -shl $suffixLength
|
||||
$startIPAddress += 1
|
||||
# if crossing a block boundary, round to the next possible start for the given suffix size
|
||||
if (($startIPAddress -shr $prefixLength) -ne 0) {
|
||||
$suffixLength = 32 - $prefixLength
|
||||
$startIPAddress = (($startIPAddress -shr $suffixLength) + 1) -shl $suffixLength
|
||||
}
|
||||
# convert and return
|
||||
$addressPrefixResult = (ConvertUInt32ToIPAddress $startIPAddress) + "/" + $prefixLength
|
||||
Write-Host "Using address prefix $addressPrefixResult." -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user