mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-09-04 04:41:34 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user