mirror of
https://github.com/moby/moby.git
synced 2026-08-03 14:41:03 +00:00
Fix api server null pointer def on inspect/ls null ipam-driver networks
- When a network is created with the null ipam driver, docker api server thread will deference a nil pointer on `docker network ls` and on `docker network inspect <nw>`. This because buildIpamResource() assumes a gateway address is always present, which is not correct. Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
This commit is contained in:
@@ -409,7 +409,9 @@ func buildIpamResources(r *types.NetworkResource, nwInfo libnetwork.NetworkInfo)
|
||||
for _, ip4Info := range ipv4Info {
|
||||
iData := network.IPAMConfig{}
|
||||
iData.Subnet = ip4Info.IPAMData.Pool.String()
|
||||
iData.Gateway = ip4Info.IPAMData.Gateway.IP.String()
|
||||
if ip4Info.IPAMData.Gateway != nil {
|
||||
iData.Gateway = ip4Info.IPAMData.Gateway.IP.String()
|
||||
}
|
||||
r.IPAM.Config = append(r.IPAM.Config, iData)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user