Merge pull request #78 from steveeJ/improve-errormsg-missing-subnet

host-local: detect missing subnet and error out
This commit is contained in:
Stefan Junker 2015-11-30 20:56:25 +01:00
commit f777ca50e5

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