host-local: detect missing subnet and error out
This commit is contained in:
parent
19c18abdb1
commit
753b10503c
@ -142,6 +142,9 @@ func (a *IPAllocator) Release(id string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func networkRange(ipnet *net.IPNet) (net.IP, net.IP, 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()
|
ip := ipnet.IP.To4()
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
ip = ipnet.IP.To16()
|
ip = ipnet.IP.To16()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user