mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17703 from aboch/np
Verify Endpoint.Info() before accessing it
This commit is contained in:
commit
f18c5e9714
2 changed files with 16 additions and 3 deletions
|
@ -191,7 +191,11 @@ func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource {
|
||||||
|
|
||||||
epl := nw.Endpoints()
|
epl := nw.Endpoints()
|
||||||
for _, e := range epl {
|
for _, e := range epl {
|
||||||
sb := e.Info().Sandbox()
|
ei := e.Info()
|
||||||
|
if ei == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
sb := ei.Sandbox()
|
||||||
if sb == nil {
|
if sb == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -233,7 +237,12 @@ func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
er.EndpointID = e.ID()
|
er.EndpointID = e.ID()
|
||||||
if iface := e.Info().Iface(); iface != nil {
|
ei := e.Info()
|
||||||
|
if ei == nil {
|
||||||
|
return er
|
||||||
|
}
|
||||||
|
|
||||||
|
if iface := ei.Iface(); iface != nil {
|
||||||
if mac := iface.MacAddress(); mac != nil {
|
if mac := iface.MacAddress(); mac != nil {
|
||||||
er.MacAddress = mac.String()
|
er.MacAddress = mac.String()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1191,7 +1191,11 @@ func (container *Container) disconnectFromNetwork(n libnetwork.Network) error {
|
||||||
)
|
)
|
||||||
|
|
||||||
s := func(current libnetwork.Endpoint) bool {
|
s := func(current libnetwork.Endpoint) bool {
|
||||||
if sb := current.Info().Sandbox(); sb != nil {
|
epInfo := current.Info()
|
||||||
|
if epInfo == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if sb := epInfo.Sandbox(); sb != nil {
|
||||||
if sb.ContainerID() == container.ID {
|
if sb.ContainerID() == container.ID {
|
||||||
ep = current
|
ep = current
|
||||||
sbox = sb
|
sbox = sb
|
||||||
|
|
Loading…
Add table
Reference in a new issue