mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #2544 from arkodg/fix-npe-ep-iface
Fix NPE due to null value returned by ep.Iface()
This commit is contained in:
commit
8844968f3f
3 changed files with 7 additions and 3 deletions
libnetwork
|
@ -596,7 +596,7 @@ func (ep *endpoint) deleteDriverInfoFromCluster() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
|
func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
|
||||||
if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface().Address() == nil {
|
if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface() == nil || ep.Iface().Address() == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, fullRemove bool, m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ep.Iface().Address() != nil {
|
if ep.Iface() != nil && ep.Iface().Address() != nil {
|
||||||
if ep.svcID != "" {
|
if ep.svcID != "" {
|
||||||
// This is a task part of a service
|
// This is a task part of a service
|
||||||
var ingressPorts []*PortConfig
|
var ingressPorts []*PortConfig
|
||||||
|
|
|
@ -979,6 +979,10 @@ func (c *controller) reservePools() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, ep := range epl {
|
for _, ep := range epl {
|
||||||
|
if ep.Iface() == nil {
|
||||||
|
logrus.Warnf("endpoint interface is empty for %q (%s)", ep.Name(), ep.ID())
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
|
if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
|
||||||
logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
|
logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
|
||||||
ep.Name(), ep.ID(), n.Name(), n.ID())
|
ep.Name(), ep.ID(), n.Name(), n.ID())
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
|
||||||
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
|
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
|
||||||
var ipv6 net.IP
|
var ipv6 net.IP
|
||||||
epName := ep.Name()
|
epName := ep.Name()
|
||||||
if iface := ep.Iface(); iface.Address() != nil {
|
if iface := ep.Iface(); iface != nil && iface.Address() != nil {
|
||||||
myAliases := ep.MyAliases()
|
myAliases := ep.MyAliases()
|
||||||
if iface.AddressIPv6() != nil {
|
if iface.AddressIPv6() != nil {
|
||||||
ipv6 = iface.AddressIPv6().IP
|
ipv6 = iface.AddressIPv6().IP
|
||||||
|
|
Loading…
Add table
Reference in a new issue