From: Stefan Junker Date: Thu, 12 Nov 2015 19:00:48 +0000 (+0100) Subject: host-local: detect missing subnet and error out X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=753b10503ca46f966a6c56b6c1335ece8a23c16f;p=cni.git host-local: detect missing subnet and error out --- diff --git a/plugins/ipam/host-local/allocator.go b/plugins/ipam/host-local/allocator.go index c333952..159e2cb 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()