From 273b764b75fab0f2148caea3b8d0122a2661fc45 Mon Sep 17 00:00:00 2001
From: Arko Dasgupta <arko.dasgupta@docker.com>
Date: Fri, 10 Jan 2020 18:53:59 -0800
Subject: [PATCH 10/14] Handle error case when fixed-cidr-ipv6 is empty

When IPv6 is enabled, make sure fixed-cidr-ipv6 is set
by the user since there is no default IPv6 local subnet
in the IPAM

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
Upstream-commit: bdad16b0eeaefd4313e92ee6f6978e4285bfaf8d
Component: engine
---
 components/engine/daemon/daemon_unix.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/engine/daemon/daemon_unix.go b/components/engine/daemon/daemon_unix.go
index 8c21807dfb..10d0b3197d 100644
--- a/components/engine/daemon/daemon_unix.go
+++ b/components/engine/daemon/daemon_unix.go
@@ -1077,7 +1077,9 @@ func initBridgeDriver(controller libnetwork.NetworkController, config *config.Co
 	}
 
 	var deferIPv6Alloc bool
-	if config.BridgeConfig.FixedCIDRv6 != "" {
+	if config.BridgeConfig.EnableIPv6 && config.BridgeConfig.FixedCIDRv6 == "" {
+		return errors.New("IPv6 is enabled for the default bridge, but no subnet is configured. Specify an IPv6 subnet using --fixed-cidr-v6")
+	} else if config.BridgeConfig.FixedCIDRv6 != "" {
 		_, fCIDRv6, err := net.ParseCIDR(config.BridgeConfig.FixedCIDRv6)
 		if err != nil {
 			return err
-- 
2.33.0

