Skip to content

Commit

Permalink
Check who previously owned an address claimed outside the range
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Jun 7, 2017
1 parent e9310eb commit ae5406b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ipam/claim.go
Expand Up @@ -51,7 +51,15 @@ func (c *claim) Try(alloc *Allocator) bool {
if !alloc.ring.Contains(c.cidr.Addr) {
// Address not within our universe; assume user knows what they are doing
alloc.infof("Address %s claimed by %s - not in our range", c.cidr, c.ident)
addOwned()
previousOwner := alloc.findOwner(c.cidr.Addr)
switch {
case previousOwner == "":
addOwned()
case previousOwner == c.ident: // already owned by this ID
case c.ident == api.NoContainerID: // already owned by anonymous container
default:
c.sendResult(fmt.Errorf("address %s already in use", c.cidr))
}
c.sendResult(nil)
return true
}
Expand Down

0 comments on commit ae5406b

Please sign in to comment.