vendor in latests containers/common

To include export HostContainersInternal

Signed-off-by: Black-Hole1 <bh@bugs.cc>
This commit is contained in:
Black-Hole1
2023-06-21 15:05:14 +08:00
parent a77f896bab
commit ae6e390760
21 changed files with 124 additions and 100 deletions

View File

@@ -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)