host-local: detect missing subnet and error out

This commit is contained in:
Stefan Junker 2015-11-12 20:00:48 +01:00
parent 19c18abdb1
commit 753b10503c

View File

@ -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()