mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Update to kube v1.17
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
327fcd1b1b
commit
3af1e26d7c
6
vendor/k8s.io/utils/net/net.go
generated
vendored
6
vendor/k8s.io/utils/net/net.go
generated
vendored
@ -19,6 +19,7 @@ package net
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"net"
|
||||
"strconv"
|
||||
@ -165,11 +166,16 @@ func AddIPOffset(base *big.Int, offset int) net.IP {
|
||||
}
|
||||
|
||||
// RangeSize returns the size of a range in valid addresses.
|
||||
// returns the size of the subnet (or math.MaxInt64 if the range size would overflow int64)
|
||||
func RangeSize(subnet *net.IPNet) int64 {
|
||||
ones, bits := subnet.Mask.Size()
|
||||
if bits == 32 && (bits-ones) >= 31 || bits == 128 && (bits-ones) >= 127 {
|
||||
return 0
|
||||
}
|
||||
// this checks that we are not overflowing an int64
|
||||
if bits-ones >= 63 {
|
||||
return math.MaxInt64
|
||||
}
|
||||
return int64(1) << uint(bits-ones)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user