mirror of
https://github.com/docker/cli.git
synced 2026-09-27 09:46:01 -04: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> (cherry picked from commit beebfc0cf6240c8af511eb4d7e29314c8de6ddf2) Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
committed by
Victor Vieux
parent
8c4be39ddd
commit
67dc2b7dac
@@ -397,7 +397,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