Parcourir la source

Check if IPv6 is enabled before restoring the network pools

Signed-off-by: Alessandro Boch <aboch@docker.com>
Alessandro Boch il y a 8 ans
Parent
commit
989d9b2cc4
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      libnetwork/controller.go

+ 5 - 3
libnetwork/controller.go

@@ -753,9 +753,11 @@ func (c *controller) reservePools() {
 				c.Gateway = n.ipamV4Info[i].Gateway.IP.String()
 			}
 		}
-		for i, c := range n.ipamV6Config {
-			if c.Gateway == "" && n.ipamV6Info[i].Gateway != nil {
-				c.Gateway = n.ipamV6Info[i].Gateway.IP.String()
+		if n.enableIPv6 {
+			for i, c := range n.ipamV6Config {
+				if c.Gateway == "" && n.ipamV6Info[i].Gateway != nil {
+					c.Gateway = n.ipamV6Info[i].Gateway.IP.String()
+				}
 			}
 		}
 		// Reserve pools