Selaa lähdekoodia

Fix cleanup logic in case of ipv6 allocation failure

- When creating a network with both IPv4 and IPv6 subnets,
  if the allocation of the IPv6 pool fails, the already
  reserved IPv4 pool does not get released.

Signed-off-by: Alessandro Boch <aboch@docker.com>
Alessandro Boch 9 vuotta sitten
vanhempi
commit
d0f96c5846
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      libnetwork/network.go

+ 6 - 1
libnetwork/network.go

@@ -1094,7 +1094,12 @@ func (n *network) ipamAllocate() error {
 		return nil
 		return nil
 	}
 	}
 
 
-	return n.ipamAllocateVersion(6, ipam)
+	err = n.ipamAllocateVersion(6, ipam)
+	if err != nil {
+		return err
+	}
+
+	return nil
 }
 }
 
 
 func (n *network) requestPoolHelper(ipam ipamapi.Ipam, addressSpace, preferredPool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
 func (n *network) requestPoolHelper(ipam ipamapi.Ipam, addressSpace, preferredPool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {