From 989d9b2cc42a8cf7db59a605a60614ee7bf3afe4 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Thu, 15 Sep 2016 11:21:33 -0700 Subject: [PATCH] Check if IPv6 is enabled before restoring the network pools Signed-off-by: Alessandro Boch --- libnetwork/controller.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libnetwork/controller.go b/libnetwork/controller.go index c63535d1b8..039c80acb7 100644 --- a/libnetwork/controller.go +++ b/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