mirror of
https://github.com/containers/podman.git
synced 2025-12-02 19:28:58 +08:00
vendor in latests containers/common
To include export HostContainersInternal Signed-off-by: Black-Hole1 <bh@bugs.cc>
This commit is contained in:
21
vendor/github.com/containers/common/libnetwork/netavark/ipam.go
generated
vendored
21
vendor/github.com/containers/common/libnetwork/netavark/ipam.go
generated
vendored
@@ -173,20 +173,23 @@ func getFreeIPFromBucket(bucket *bbolt.Bucket, subnet *types.Subnet) (net.IP, er
|
||||
if rangeStart == nil {
|
||||
// let start with the first ip in subnet
|
||||
rangeStart = util.NextIP(subnet.Subnet.IP)
|
||||
} else if util.Cmp(rangeStart, subnet.Subnet.IP) == 0 {
|
||||
// when we start on the subnet ip we need to inc by one as the subnet ip cannot be assigned
|
||||
rangeStart = util.NextIP(rangeStart)
|
||||
}
|
||||
|
||||
lastIP, err := util.LastIPInSubnet(&subnet.Subnet.IPNet)
|
||||
// this error should never happen but lets check anyways to prevent panics
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get lastIP: %w", err)
|
||||
}
|
||||
if rangeEnd == nil {
|
||||
lastIP, err := util.LastIPInSubnet(&subnet.Subnet.IPNet)
|
||||
// this error should never happen but lets check anyways to prevent panics
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get lastIP: %w", err)
|
||||
}
|
||||
// ipv4 uses the last ip in a subnet for broadcast so we cannot use it
|
||||
if util.IsIPv4(lastIP) {
|
||||
lastIP = util.PrevIP(lastIP)
|
||||
}
|
||||
rangeEnd = lastIP
|
||||
}
|
||||
// ipv4 uses the last ip in a subnet for broadcast so we cannot use it
|
||||
if util.IsIPv4(rangeEnd) && util.Cmp(rangeEnd, lastIP) == 0 {
|
||||
rangeEnd = util.PrevIP(rangeEnd)
|
||||
}
|
||||
|
||||
lastIPByte := bucket.Get(lastIPKey)
|
||||
curIP := net.IP(lastIPByte)
|
||||
|
||||
Reference in New Issue
Block a user