Skip to content

Commit

Permalink
Skip the first IP for IPv6 as well
Browse files Browse the repository at this point in the history
Otherwise this forces use of a configured subnet.
  • Loading branch information
justinsb committed Oct 31, 2014
1 parent 33cc917 commit 3662189
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions daemon/networkdriver/ipallocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ type allocatedMap struct {

func newAllocatedMap(network *net.IPNet) *allocatedMap {
firstIP, lastIP := networkdriver.NetworkRange(network)
begin := big.NewInt(0).Add(ipToBigInt(firstIP), big.NewInt(1))
// Skip the first IP, reserving it for the bridge
begin := big.NewInt(0).Add(ipToBigInt(firstIP), big.NewInt(2))
end := big.NewInt(0).Sub(ipToBigInt(lastIP), big.NewInt(1))

// if IPv4 network, then allocation range starts at begin + 1 because begin is bridge IP
if len(firstIP) == 4 {
begin = begin.Add(begin, big.NewInt(1))
}

return &allocatedMap{
p: make(map[string]struct{}),
begin: begin,
Expand Down

0 comments on commit 3662189

Please sign in to comment.