Misc fixes to ip allocation in bridge driver

Two changes were missing:
- On allocation of bridge ip was not passing canonical subnet
- Canonical subnet has to be passed on ip release
  as well, otherwise ipallocator will attempt
  ip release from a non registered nw

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch
2015-07-24 16:59:27 -07:00
parent bf4ea43b71
commit fd896b98ce
3 changed files with 16 additions and 6 deletions
+10
View File
@@ -173,6 +173,16 @@ func GetIPNetCopy(from *net.IPNet) *net.IPNet {
return &net.IPNet{IP: GetIPCopy(from.IP), Mask: bm}
}
// GetIPNetCanonical returns the canonical form for the passed network
func GetIPNetCanonical(nw *net.IPNet) *net.IPNet {
if nw == nil {
return nil
}
c := GetIPNetCopy(nw)
c.IP = c.IP.Mask(nw.Mask)
return c
}
// CompareIPNet returns equal if the two IP Networks are equal
func CompareIPNet(a, b *net.IPNet) bool {
if a == b {