Browse code

[19.03] update libnetwork b9bcf0c3fba9ef8897c9676c5b70ba0345b84b17

full diff: https://github.com/docker/libnetwork/compare/0941c3f409260d5f05cfa6fc68420d8ad45ee483...b9bcf0c3fba9ef8897c9676c5b70ba0345b84b17

- docker/libnetwork#2545 Fix NPE due to null value returned by ep.Iface()
- backport of docker/libnetwork#2544
- addresses docker/docker#37506

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/04/11 03:26:09
Showing 4 changed files
... ...
@@ -38,7 +38,7 @@ github.com/gofrs/flock                              7f43ea2e6a643ad441fc12d0ecc0
38 38
 # libnetwork
39 39
 
40 40
 # When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
41
-github.com/docker/libnetwork                        0941c3f409260d5f05cfa6fc68420d8ad45ee483 # bump_19.03 branch
41
+github.com/docker/libnetwork                        b9bcf0c3fba9ef8897c9676c5b70ba0345b84b17 # bump_19.03 branch
42 42
 github.com/docker/go-events                         9461782956ad83b30282bf90e31fa6a70c255ba9
43 43
 github.com/armon/go-radix                           e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
44 44
 github.com/armon/go-metrics                         eb0af217e5e9747e41dd5303755356b62d28e3ec
... ...
@@ -596,7 +596,7 @@ func (ep *endpoint) deleteDriverInfoFromCluster() error {
596 596
 }
597 597
 
598 598
 func (ep *endpoint) addServiceInfoToCluster(sb *sandbox) error {
599
-	if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface().Address() == nil {
599
+	if ep.isAnonymous() && len(ep.myAliases) == 0 || ep.Iface() == nil || ep.Iface().Address() == nil {
600 600
 		return nil
601 601
 	}
602 602
 
... ...
@@ -719,7 +719,7 @@ func (ep *endpoint) deleteServiceInfoFromCluster(sb *sandbox, fullRemove bool, m
719 719
 		}
720 720
 	}
721 721
 
722
-	if ep.Iface().Address() != nil {
722
+	if ep.Iface() != nil && ep.Iface().Address() != nil {
723 723
 		if ep.svcID != "" {
724 724
 			// This is a task part of a service
725 725
 			var ingressPorts []*PortConfig
... ...
@@ -979,6 +979,10 @@ func (c *controller) reservePools() {
979 979
 			continue
980 980
 		}
981 981
 		for _, ep := range epl {
982
+			if ep.Iface() == nil {
983
+				logrus.Warnf("endpoint interface is empty for %q (%s)", ep.Name(), ep.ID())
984
+				continue
985
+			}
982 986
 			if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
983 987
 				logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
984 988
 					ep.Name(), ep.ID(), n.Name(), n.ID())
... ...
@@ -1329,7 +1329,7 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
1329 1329
 func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
1330 1330
 	var ipv6 net.IP
1331 1331
 	epName := ep.Name()
1332
-	if iface := ep.Iface(); iface.Address() != nil {
1332
+	if iface := ep.Iface(); iface != nil && iface.Address() != nil {
1333 1333
 		myAliases := ep.MyAliases()
1334 1334
 		if iface.AddressIPv6() != nil {
1335 1335
 			ipv6 = iface.AddressIPv6().IP