File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
samples/manage/azure-sql-db-managed-instance/attach-vpn-gateway Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -164,9 +164,12 @@ function CalculateNextAddressPrefix {
164164 }
165165 $startIPAddress += 1
166166 # if crossing a block boundary, round to the next possible start for the given suffix size
167- if (($startIPAddress -shr $prefixLength ) -ne 0 ) {
168- $suffixLength = 32 - $prefixLength
169- $startIPAddress = (($startIPAddress -shr $suffixLength ) + 1 ) -shl $suffixLength
167+ $suffixLength = 32 - $prefixLength
168+ $mask = (1 -shl $suffixLength ) - 1
169+ if (($startIPAddress -band $mask ) -ne $startIPAddress ) {
170+ $x = $startIPAddress -shr $suffixLength
171+ $x += 1
172+ $startIPAddress = $x -shl $suffixLength
170173 }
171174 # convert and return
172175 $addressPrefixResult = (ConvertUInt32ToIPAddress $startIPAddress ) + " /" + $prefixLength
You can’t perform that action at this time.
0 commit comments