From 753b10503ca46f966a6c56b6c1335ece8a23c16f Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Thu, 12 Nov 2015 20:00:48 +0100 Subject: [PATCH] host-local: detect missing subnet and error out --- plugins/ipam/host-local/allocator.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/ipam/host-local/allocator.go b/plugins/ipam/host-local/allocator.go index c333952c..159e2cb7 100644 --- a/plugins/ipam/host-local/allocator.go +++ b/plugins/ipam/host-local/allocator.go @@ -142,6 +142,9 @@ func (a *IPAllocator) Release(id string) error { } func networkRange(ipnet *net.IPNet) (net.IP, net.IP, error) { + if ipnet.IP == nil { + return nil, nil, fmt.Errorf("missing field %q in IPAM configuration", "subnet") + } ip := ipnet.IP.To4() if ip == nil { ip = ipnet.IP.To16()