Browse Source

Merge pull request #36004 from cpuguy83/update_libnetwork

Update libnetwork commit
Vincent Demeester 7 năm trước cách đây
mục cha
commit
f909bf3590

+ 1 - 1
hack/dockerfile/binaries-commits

@@ -10,7 +10,7 @@ RUNC_COMMIT=9f9c96235cc97674e935002fc3d78361b696a69e
 # fixes or new APIs.
 # fixes or new APIs.
 CONTAINERD_COMMIT=9b55aab90508bd389d7654c4baf173a981477d55 # v1.0.1
 CONTAINERD_COMMIT=9b55aab90508bd389d7654c4baf173a981477d55 # v1.0.1
 TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574
 TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574
-LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e
+LIBNETWORK_COMMIT=fcf1c3b5e57833aaaa756ae3c4140ea54da00319
 VNDR_COMMIT=a6e196d8b4b0cbbdc29aebdb20c59ac6926bb384
 VNDR_COMMIT=a6e196d8b4b0cbbdc29aebdb20c59ac6926bb384
 
 
 # Linting
 # Linting

+ 1 - 1
vendor.conf

@@ -31,7 +31,7 @@ github.com/moby/buildkit aaff9d591ef128560018433fe61beb802e149de8
 github.com/tonistiigi/fsutil dea3a0da73aee887fc02142d995be764106ac5e2
 github.com/tonistiigi/fsutil dea3a0da73aee887fc02142d995be764106ac5e2
 
 
 #get libnetwork packages
 #get libnetwork packages
-github.com/docker/libnetwork 315a076a4e9ded2abc950318c71d5f1637547977 
+github.com/docker/libnetwork fcf1c3b5e57833aaaa756ae3c4140ea54da00319
 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

+ 1 - 3
vendor/github.com/docker/libnetwork/controller.go

@@ -882,9 +882,7 @@ addToStore:
 		c.Unlock()
 		c.Unlock()
 	}
 	}
 
 
-	c.Lock()
-	arrangeUserFilterRule()
-	c.Unlock()
+	c.arrangeUserFilterRule()
 
 
 	return network, nil
 	return network, nil
 }
 }

+ 18 - 2
vendor/github.com/docker/libnetwork/drivers/overlay/ov_network.go

@@ -711,7 +711,7 @@ func (n *network) initSandbox(restore bool) error {
 	n.setNetlinkSocket(nlSock)
 	n.setNetlinkSocket(nlSock)
 
 
 	if err == nil {
 	if err == nil {
-		go n.watchMiss(nlSock)
+		go n.watchMiss(nlSock, key)
 	} else {
 	} else {
 		logrus.Errorf("failed to subscribe to neighbor group netlink messages for overlay network %s in sbox %s: %v",
 		logrus.Errorf("failed to subscribe to neighbor group netlink messages for overlay network %s in sbox %s: %v",
 			n.id, sbox.Key(), err)
 			n.id, sbox.Key(), err)
@@ -720,7 +720,23 @@ func (n *network) initSandbox(restore bool) error {
 	return nil
 	return nil
 }
 }
 
 
-func (n *network) watchMiss(nlSock *nl.NetlinkSocket) {
+func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
+	// With the new version of the netlink library the deserialize function makes
+	// requests about the interface of the netlink message. This can succeed only
+	// if this go routine is in the target namespace. For this reason following we
+	// lock the thread on that namespace
+	runtime.LockOSThread()
+	defer runtime.UnlockOSThread()
+	newNs, err := netns.GetFromPath(nsPath)
+	if err != nil {
+		logrus.WithError(err).Errorf("failed to get the namespace %s", nsPath)
+		return
+	}
+	defer newNs.Close()
+	if err = netns.Set(newNs); err != nil {
+		logrus.WithError(err).Errorf("failed to enter the namespace %s", nsPath)
+		return
+	}
 	for {
 	for {
 		msgs, err := nlSock.Receive()
 		msgs, err := nlSock.Receive()
 		if err != nil {
 		if err != nil {

+ 11 - 0
vendor/github.com/docker/libnetwork/firewall_linux.go

@@ -7,6 +7,17 @@ import (
 
 
 const userChain = "DOCKER-USER"
 const userChain = "DOCKER-USER"
 
 
+func (c *controller) arrangeUserFilterRule() {
+	c.Lock()
+	arrangeUserFilterRule()
+	c.Unlock()
+	iptables.OnReloaded(func() {
+		c.Lock()
+		arrangeUserFilterRule()
+		c.Unlock()
+	})
+}
+
 // This chain allow users to configure firewall policies in a way that persists
 // This chain allow users to configure firewall policies in a way that persists
 // docker operations/restarts. Docker will not delete or modify any pre-existing
 // docker operations/restarts. Docker will not delete or modify any pre-existing
 // rules from the DOCKER-USER filter chain.
 // rules from the DOCKER-USER filter chain.

+ 1 - 1
vendor/github.com/docker/libnetwork/firewall_others.go

@@ -2,5 +2,5 @@
 
 
 package libnetwork
 package libnetwork
 
 
-func arrangeUserFilterRule() {
+func (c *controller) arrangeUserFilterRule() {
 }
 }