Hello community,
here is the log from the commit of package golang-github-docker-libnetwork for
openSUSE:Factory checked in at 2019-05-06 21:14:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-docker-libnetwork (Old)
and /work/SRC/openSUSE:Factory/.golang-github-docker-libnetwork.new.5148
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-github-docker-libnetwork"
Mon May 6 21:14:40 2019 rev:15 rq:701148 version:0.7.0.1+gitr2726_872f0a83c98a
Changes:
--------
---
/work/SRC/openSUSE:Factory/golang-github-docker-libnetwork/golang-github-docker-libnetwork.changes
2019-02-13 09:57:32.257677080 +0100
+++
/work/SRC/openSUSE:Factory/.golang-github-docker-libnetwork.new.5148/golang-github-docker-libnetwork.changes
2019-05-06 21:14:42.236664308 +0200
@@ -1,0 +2,31 @@
+Mon May 06 18:21:12 UTC 2019 - [email protected]
+
+- Update to version git.872f0a83c98add6cae255c8859e29532febc0039 which is
+ required for Docker v18.09.6-ce.
+ * Pick a random host port if the user does not specify a host port.
+ * Cleanup the cluster provider when the agent is closed
+ * Adding error log if peerAdd fails
+ * Adding synchronization to endpoint addition/deletion to prevent network
connectivity issue
+ * Revert "Merge pull request #2286 from
thaJeztah/18.09_backport_iptables_legacy"
+ * Bump Go to 1.10.7
+ * Fix possible nil pointer exception
+ * Fix gosimple
+ * account for removal of configs.HookState
+
+-------------------------------------------------------------------
+Fri May 03 13:16:44 UTC 2019 - Aleksa Sarai <[email protected]>
+
+- Update to version git.4725f2163fb214a6312f3beae5991f838ec36326 which is
+ required for Docker v18.09.5-ce: bsc#1128376 boo#1134068
+ * Revert "Merge pull request #2286 from
thaJeztah/18.09_backport_iptables_legacy"
+ * Bump Go to 1.10.7
+ * Fix possible nil pointer exception
+ * Fix gosimple
+ * account for removal of configs.HookState
+ * vndr runc 96ec217
+ * Update golint tool
+ * debian has iptables-legacy and iptables-nft now
+ * Make DSR an overlay-specific driver "option"
+ * Set east-west load balancing to use direct routing
+
+-------------------------------------------------------------------
Old:
----
libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382.tar.xz
New:
----
libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-github-docker-libnetwork.spec ++++++
--- /var/tmp/diff_new_pack.2aO24r/_old 2019-05-06 21:14:42.888666078 +0200
+++ /var/tmp/diff_new_pack.2aO24r/_new 2019-05-06 21:14:42.892666088 +0200
@@ -29,14 +29,14 @@
%endif
# MANUAL: Update the git_version and git_revision
-%define git_version 2cfbf9b1f98162a55829a21cc603c76072a75382
-%define git_short 2cfbf9b1f981
+%define git_version 872f0a83c98add6cae255c8859e29532febc0039
+%define git_short 872f0a83c98a
# How to get the git_revision
# git clone https://github.com/docker/libnetwork.git libnetwork
# cd libnetwork
# git checkout $git_version
# git_revision=r$(git rev-list HEAD | wc -l)
-%define git_revision r2711
+%define git_revision r2726
%global provider github
%global provider_tld com
@@ -63,7 +63,7 @@
BuildRequires: fdupes
BuildRequires: golang-packaging
BuildRequires: xz
-BuildRequires: golang(API) = 1.10
+BuildRequires: golang(API) >= 1.10
ExcludeArch: s390
# KUBIC-SPECIFIC: This was required when upgrading from the original kubic
# packaging, when everything was renamed to -kubic. It also is
++++++ _service ++++++
--- /var/tmp/diff_new_pack.2aO24r/_old 2019-05-06 21:14:42.928666186 +0200
+++ /var/tmp/diff_new_pack.2aO24r/_new 2019-05-06 21:14:42.928666186 +0200
@@ -4,7 +4,7 @@
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="versionformat">git.%H</param>
- <param name="revision">2cfbf9b1f98162a55829a21cc603c76072a75382</param>
+ <param name="revision">872f0a83c98add6cae255c8859e29532febc0039</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
++++++ libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382.tar.xz ->
libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/Dockerfile
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/Dockerfile
--- old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/Dockerfile
2018-12-07 16:40:35.000000000 +0100
+++ new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/Dockerfile
2019-04-23 18:19:33.000000000 +0200
@@ -1,4 +1,4 @@
-FROM golang:1.10.2 as dev
+FROM golang:1.10.7 as dev
RUN apt-get update && apt-get -y install iptables \
protobuf-compiler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/agent.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/agent.go
--- old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/agent.go
2018-12-07 16:40:35.000000000 +0100
+++ new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/agent.go
2019-04-23 18:19:33.000000000 +0200
@@ -378,6 +378,9 @@
c.agent = nil
c.Unlock()
+ // when the agent is closed the cluster provider should be cleaned up
+ c.SetClusterProvider(nil)
+
if agent == nil {
return
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/default_gateway.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/default_gateway.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/default_gateway.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/default_gateway.go
2019-04-23 18:19:33.000000000 +0200
@@ -181,10 +181,8 @@
defer func() { <-procGwNetwork }()
n, err := c.NetworkByName(libnGWNetwork)
- if err != nil {
- if _, ok := err.(types.NotFoundError); ok {
- n, err = c.createGWNetwork()
- }
+ if _, ok := err.(types.NotFoundError); ok {
+ n, err = c.createGWNetwork()
}
return n, err
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/joinleave_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/joinleave_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/joinleave_windows.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/joinleave_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -95,7 +95,10 @@
return
}
- d.peerAdd(nid, eid, addr.IP, addr.Mask, mac, vtep, true)
+ err = d.peerAdd(nid, eid, addr.IP, addr.Mask, mac, vtep, true)
+ if err != nil {
+ logrus.Errorf("peerAdd failed (%v) for ip %s with mac %s", err,
addr.IP.String(), mac.String())
+ }
}
func (d *driver) DecodeTableEntry(tablename string, key string, value []byte)
(string, map[string]string) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/ov_endpoint_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/ov_endpoint_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/ov_endpoint_windows.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/ov_endpoint_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -4,6 +4,7 @@
"encoding/json"
"fmt"
"net"
+ "sync"
"github.com/Microsoft/hcsshim"
"github.com/docker/docker/pkg/system"
@@ -29,6 +30,13 @@
portMapping []types.PortBinding // Operation port bindings
}
+var (
+ //Server 2016 (RS1) does not support concurrent add/delete of
endpoints. Therefore, we need
+ //to use this mutex and serialize the add/delete of endpoints on RS1.
+ endpointMu sync.Mutex
+ windowsBuild = system.GetOSVersion().Build
+)
+
func validateID(nid, eid string) error {
if nid == "" {
return fmt.Errorf("invalid network id")
@@ -77,8 +85,7 @@
if networkEndpoint != nil {
logrus.Debugf("Removing stale endpoint from HNS")
- _, err := hcsshim.HNSEndpointRequest("DELETE",
networkEndpoint.profileID, "")
-
+ _, err := endpointRequest("DELETE", networkEndpoint.profileID,
"")
if err != nil {
logrus.Debugf("Failed to delete stale overlay endpoint
(%.7s) from hns", networkEndpoint.id)
}
@@ -101,8 +108,7 @@
if ep != nil {
logrus.Debugf("Deleting stale endpoint %s", eid)
n.deleteEndpoint(eid)
-
- _, err := hcsshim.HNSEndpointRequest("DELETE", ep.profileID, "")
+ _, err := endpointRequest("DELETE", ep.profileID, "")
if err != nil {
return err
}
@@ -165,7 +171,19 @@
return err
}
- pbPolicy, err :=
windows.ConvertPortBindings(epConnectivity.PortBindings)
+ ep.portMapping = epConnectivity.PortBindings
+ ep.portMapping, err = windows.AllocatePorts(n.portMapper,
ep.portMapping, ep.addr.IP)
+ if err != nil {
+ return err
+ }
+
+ defer func() {
+ if err != nil {
+ windows.ReleasePorts(n.portMapper,
ep.portMapping)
+ }
+ }()
+
+ pbPolicy, err := windows.ConvertPortBindings(ep.portMapping)
if err != nil {
return err
}
@@ -179,7 +197,7 @@
return err
}
- hnsresponse, err := hcsshim.HNSEndpointRequest("POST", "",
string(configurationb))
+ hnsresponse, err := endpointRequest("POST", "", string(configurationb))
if err != nil {
return err
}
@@ -199,7 +217,7 @@
ep.portMapping, err =
windows.ParsePortBindingPolicies(hnsresponse.Policies)
if err != nil {
- hcsshim.HNSEndpointRequest("DELETE", hnsresponse.Id, "")
+ endpointRequest("DELETE", hnsresponse.Id, "")
return err
}
@@ -223,9 +241,11 @@
return fmt.Errorf("endpoint id %q not found", eid)
}
+ windows.ReleasePorts(n.portMapper, ep.portMapping)
+
n.deleteEndpoint(eid)
- _, err := hcsshim.HNSEndpointRequest("DELETE", ep.profileID, "")
+ _, err := endpointRequest("DELETE", ep.profileID, "")
if err != nil {
return err
}
@@ -263,3 +283,14 @@
return data, nil
}
+
+func endpointRequest(method, path, request string) (*hcsshim.HNSEndpoint,
error) {
+ if windowsBuild == 14393 {
+ endpointMu.Lock()
+ }
+ hnsresponse, err := hcsshim.HNSEndpointRequest(method, path, request)
+ if windowsBuild == 14393 {
+ endpointMu.Unlock()
+ }
+ return hnsresponse, err
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/ov_network_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/ov_network_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/ov_network_windows.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/ov_network_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -11,6 +11,7 @@
"github.com/Microsoft/hcsshim"
"github.com/docker/libnetwork/driverapi"
"github.com/docker/libnetwork/netlabel"
+ "github.com/docker/libnetwork/portmapper"
"github.com/docker/libnetwork/types"
"github.com/sirupsen/logrus"
)
@@ -46,6 +47,7 @@
initErr error
subnets []*subnet
secure bool
+ portMapper *portmapper.PortMapper
sync.Mutex
}
@@ -89,10 +91,11 @@
}
n := &network{
- id: id,
- driver: d,
- endpoints: endpointTable{},
- subnets: []*subnet{},
+ id: id,
+ driver: d,
+ endpoints: endpointTable{},
+ subnets: []*subnet{},
+ portMapper: portmapper.New(""),
}
genData, ok := option[netlabel.GenericData].(map[string]string)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/peerdb_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/peerdb_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/overlay/peerdb_windows.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/overlay/peerdb_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -67,8 +67,7 @@
}
n.removeEndpointWithAddress(addr)
-
- hnsresponse, err := hcsshim.HNSEndpointRequest("POST", "",
string(configurationb))
+ hnsresponse, err := endpointRequest("POST", "",
string(configurationb))
if err != nil {
return err
}
@@ -108,7 +107,7 @@
}
if updateDb {
- _, err := hcsshim.HNSEndpointRequest("DELETE", ep.profileID, "")
+ _, err := endpointRequest("DELETE", ep.profileID, "")
if err != nil {
return err
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/port_mapping.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/port_mapping.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/port_mapping.go
1970-01-01 01:00:00.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/port_mapping.go
2019-04-23 18:19:33.000000000 +0200
@@ -0,0 +1,125 @@
+// +build windows
+
+package windows
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "net"
+
+ "github.com/docker/libnetwork/portmapper"
+ "github.com/docker/libnetwork/types"
+ "github.com/ishidawataru/sctp"
+ "github.com/sirupsen/logrus"
+)
+
+const (
+ maxAllocatePortAttempts = 10
+)
+
+// ErrUnsupportedAddressType is returned when the specified address type is
not supported.
+type ErrUnsupportedAddressType string
+
+func (uat ErrUnsupportedAddressType) Error() string {
+ return fmt.Sprintf("unsupported address type: %s", string(uat))
+}
+
+// AllocatePorts allocates ports specified in bindings from the portMapper
+func AllocatePorts(portMapper *portmapper.PortMapper, bindings
[]types.PortBinding, containerIP net.IP) ([]types.PortBinding, error) {
+ bs := make([]types.PortBinding, 0, len(bindings))
+ for _, c := range bindings {
+ b := c.GetCopy()
+ if err := allocatePort(portMapper, &b, containerIP); err != nil
{
+ // On allocation failure, release previously allocated
ports. On cleanup error, just log a warning message
+ if cuErr := ReleasePorts(portMapper, bs); cuErr != nil {
+ logrus.Warnf("Upon allocation failure for %v,
failed to clear previously allocated port bindings: %v", b, cuErr)
+ }
+ return nil, err
+ }
+ bs = append(bs, b)
+ }
+ return bs, nil
+}
+
+func allocatePort(portMapper *portmapper.PortMapper, bnd *types.PortBinding,
containerIP net.IP) error {
+ var (
+ host net.Addr
+ err error
+ )
+
+ // Store the container interface address in the operational binding
+ bnd.IP = containerIP
+
+ // Adjust HostPortEnd if this is not a range.
+ if bnd.HostPortEnd == 0 {
+ bnd.HostPortEnd = bnd.HostPort
+ }
+
+ // Construct the container side transport address
+ container, err := bnd.ContainerAddr()
+ if err != nil {
+ return err
+ }
+
+ // Try up to maxAllocatePortAttempts times to get a port that's not
already allocated.
+ for i := 0; i < maxAllocatePortAttempts; i++ {
+ if host, err = portMapper.MapRange(container, bnd.HostIP,
int(bnd.HostPort), int(bnd.HostPortEnd), false); err == nil {
+ break
+ }
+ // There is no point in immediately retrying to map an
explicitly chosen port.
+ if bnd.HostPort != 0 {
+ logrus.Warnf("Failed to allocate and map port %d-%d:
%s", bnd.HostPort, bnd.HostPortEnd, err)
+ break
+ }
+ logrus.Warnf("Failed to allocate and map port: %s, retry: %d",
err, i+1)
+ }
+ if err != nil {
+ return err
+ }
+
+ // Save the host port (regardless it was or not specified in the
binding)
+ switch netAddr := host.(type) {
+ case *net.TCPAddr:
+ bnd.HostPort = uint16(host.(*net.TCPAddr).Port)
+ break
+ case *net.UDPAddr:
+ bnd.HostPort = uint16(host.(*net.UDPAddr).Port)
+ break
+ case *sctp.SCTPAddr:
+ bnd.HostPort = uint16(host.(*sctp.SCTPAddr).Port)
+ break
+ default:
+ // For completeness
+ return ErrUnsupportedAddressType(fmt.Sprintf("%T", netAddr))
+ }
+ //Windows does not support host port ranges.
+ bnd.HostPortEnd = bnd.HostPort
+ return nil
+}
+
+// ReleasePorts releases ports specified in bindings from the portMapper
+func ReleasePorts(portMapper *portmapper.PortMapper, bindings
[]types.PortBinding) error {
+ var errorBuf bytes.Buffer
+
+ // Attempt to release all port bindings, do not stop on failure
+ for _, m := range bindings {
+ if err := releasePort(portMapper, m); err != nil {
+ errorBuf.WriteString(fmt.Sprintf("\ncould not release
%v because of %v", m, err))
+ }
+ }
+
+ if errorBuf.Len() != 0 {
+ return errors.New(errorBuf.String())
+ }
+ return nil
+}
+
+func releasePort(portMapper *portmapper.PortMapper, bnd types.PortBinding)
error {
+ // Construct the host side transport address
+ host, err := bnd.HostAddr()
+ if err != nil {
+ return err
+ }
+ return portMapper.Unmap(host)
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/drivers/windows/windows.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/drivers/windows/windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -25,6 +25,7 @@
"github.com/docker/libnetwork/discoverapi"
"github.com/docker/libnetwork/driverapi"
"github.com/docker/libnetwork/netlabel"
+ "github.com/docker/libnetwork/portmapper"
"github.com/docker/libnetwork/types"
"github.com/sirupsen/logrus"
)
@@ -88,11 +89,12 @@
}
type hnsNetwork struct {
- id string
- created bool
- config *networkConfiguration
- endpoints map[string]*hnsEndpoint // key: endpoint id
- driver *driver // The network's driver
+ id string
+ created bool
+ config *networkConfiguration
+ endpoints map[string]*hnsEndpoint // key: endpoint id
+ driver *driver // The network's driver
+ portMapper *portmapper.PortMapper
sync.Mutex
}
@@ -252,10 +254,11 @@
func (d *driver) createNetwork(config *networkConfiguration) error {
network := &hnsNetwork{
- id: config.ID,
- endpoints: make(map[string]*hnsEndpoint),
- config: config,
- driver: d,
+ id: config.ID,
+ endpoints: make(map[string]*hnsEndpoint),
+ config: config,
+ driver: d,
+ portMapper: portmapper.New(""),
}
d.Lock()
@@ -610,7 +613,27 @@
endpointStruct.MacAddress =
strings.Replace(macAddress.String(), ":", "-", -1)
}
- endpointStruct.Policies, err =
ConvertPortBindings(epConnectivity.PortBindings)
+ portMapping := epConnectivity.PortBindings
+
+ if n.config.Type == "l2bridge" || n.config.Type == "l2tunnel" {
+ ip := net.IPv4(0, 0, 0, 0)
+ if ifInfo.Address() != nil {
+ ip = ifInfo.Address().IP
+ }
+
+ portMapping, err = AllocatePorts(n.portMapper, portMapping, ip)
+ if err != nil {
+ return err
+ }
+
+ defer func() {
+ if err != nil {
+ ReleasePorts(n.portMapper, portMapping)
+ }
+ }()
+ }
+
+ endpointStruct.Policies, err = ConvertPortBindings(portMapping)
if err != nil {
return err
}
@@ -721,6 +744,10 @@
return err
}
+ if n.config.Type == "l2bridge" || n.config.Type == "l2tunnel" {
+ ReleasePorts(n.portMapper, ep.portMapping)
+ }
+
n.Lock()
delete(n.endpoints, eid)
n.Unlock()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/iptables/iptables.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/iptables/iptables.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/iptables/iptables.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/iptables/iptables.go
2019-04-23 18:19:33.000000000 +0200
@@ -87,16 +87,11 @@
}
func detectIptables() {
- path, err := exec.LookPath("iptables-legacy") // debian has
iptables-legacy and iptables-nft now
+ path, err := exec.LookPath("iptables")
if err != nil {
- path, err = exec.LookPath("iptables")
- if err != nil {
- return
- }
+ return
}
-
iptablesPath = path
-
supportsXlock = exec.Command(iptablesPath, "--wait", "-L", "-n").Run()
== nil
mj, mn, mc, err := GetVersion()
if err != nil {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/network.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/network.go
--- old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/network.go
2018-12-07 16:40:35.000000000 +0100
+++ new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/network.go
2019-04-23 18:19:33.000000000 +0200
@@ -396,11 +396,9 @@
driverOptions map[string]string
opts interface{}
)
- switch data.(type) {
- case map[string]interface{}:
- opts = data.(map[string]interface{})
- case map[string]string:
- opts = data.(map[string]string)
+ switch t := data.(type) {
+ case map[string]interface{}, map[string]string:
+ opts = t
}
ba, err := json.Marshal(opts)
if err != nil {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/networkdb/cluster.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/networkdb/cluster.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/networkdb/cluster.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/networkdb/cluster.go
2019-04-23 18:19:33.000000000 +0200
@@ -288,7 +288,12 @@
return
}
- myself, _ := nDB.nodes[nDB.config.NodeID]
+ myself, ok := nDB.nodes[nDB.config.NodeID]
+ if !ok {
+ nDB.RUnlock()
+ logrus.Warnf("rejoinClusterBootstrap unable to find local node
info using ID:%v", nDB.config.NodeID)
+ return
+ }
bootStrapIPs := make([]string, 0, len(nDB.bootStrapIP))
for _, bootIP := range nDB.bootStrapIP {
// botostrap IPs are usually IP:port from the Join
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portallocator/portallocator_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portallocator/portallocator_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portallocator/portallocator_windows.go
1970-01-01 01:00:00.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portallocator/portallocator_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -0,0 +1,10 @@
+package portallocator
+
+const (
+ StartPortRange = 60000
+ EndPortRange = 65000
+)
+
+func getDynamicPortRange() (start int, end int, err error) {
+ return StartPortRange, EndPortRange, nil
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper.go
2018-12-07 16:40:35.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper.go
2019-04-23 18:19:33.000000000 +0200
@@ -4,9 +4,7 @@
"errors"
"fmt"
"net"
- "sync"
- "github.com/docker/libnetwork/iptables"
"github.com/docker/libnetwork/portallocator"
"github.com/ishidawataru/sctp"
"github.com/sirupsen/logrus"
@@ -32,20 +30,6 @@
ErrSCTPAddrNoIP = errors.New("sctp address does not contain any IP
address")
)
-// PortMapper manages the network address translation
-type PortMapper struct {
- chain *iptables.ChainInfo
- bridgeName string
-
- // udp:ip:port
- currentMappings map[string]*mapping
- lock sync.Mutex
-
- proxyPath string
-
- Allocator *portallocator.PortAllocator
-}
-
// New returns a new instance of PortMapper
func New(proxyPath string) *PortMapper {
return NewWithPortAllocator(portallocator.Get(), proxyPath)
@@ -60,12 +44,6 @@
}
}
-// SetIptablesChain sets the specified chain into portmapper
-func (pm *PortMapper) SetIptablesChain(c *iptables.ChainInfo, bridgeName
string) {
- pm.chain = c
- pm.bridgeName = bridgeName
-}
-
// Map maps the specified container transport address to the host's network
address and transport port
func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int,
useProxy bool) (host net.Addr, err error) {
return pm.MapRange(container, hostIP, hostPort, hostPort, useProxy)
@@ -174,7 +152,7 @@
containerIP, containerPort := getIPAndPort(m.container)
if hostIP.To4() != nil {
- if err := pm.forward(iptables.Append, m.proto, hostIP,
allocatedHostPort, containerIP.String(), containerPort); err != nil {
+ if err := pm.AppendForwardingTableEntry(m.proto, hostIP,
allocatedHostPort, containerIP.String(), containerPort); err != nil {
return nil, err
}
}
@@ -183,7 +161,7 @@
// need to undo the iptables rules before we return
m.userlandProxy.Stop()
if hostIP.To4() != nil {
- pm.forward(iptables.Delete, m.proto, hostIP,
allocatedHostPort, containerIP.String(), containerPort)
+ pm.DeleteForwardingTableEntry(m.proto, hostIP,
allocatedHostPort, containerIP.String(), containerPort)
if err := pm.Allocator.ReleasePort(hostIP, m.proto,
allocatedHostPort); err != nil {
return err
}
@@ -222,7 +200,7 @@
containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host)
- if err := pm.forward(iptables.Delete, data.proto, hostIP, hostPort,
containerIP.String(), containerPort); err != nil {
+ if err := pm.DeleteForwardingTableEntry(data.proto, hostIP, hostPort,
containerIP.String(), containerPort); err != nil {
logrus.Errorf("Error on iptables delete: %s", err)
}
@@ -248,7 +226,7 @@
for _, data := range pm.currentMappings {
containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host)
- if err := pm.forward(iptables.Append, data.proto, hostIP,
hostPort, containerIP.String(), containerPort); err != nil {
+ if err := pm.AppendForwardingTableEntry(data.proto, hostIP,
hostPort, containerIP.String(), containerPort); err != nil {
logrus.Errorf("Error on iptables add: %s", err)
}
}
@@ -285,10 +263,3 @@
}
return nil, 0
}
-
-func (pm *PortMapper) forward(action iptables.Action, proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
- if pm.chain == nil {
- return nil
- }
- return pm.chain.Forward(action, sourceIP, sourcePort, proto,
containerIP, containerPort, pm.bridgeName)
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper_linux.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper_linux.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper_linux.go
1970-01-01 01:00:00.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper_linux.go
2019-04-23 18:19:33.000000000 +0200
@@ -0,0 +1,46 @@
+package portmapper
+
+import (
+ "net"
+ "sync"
+
+ "github.com/docker/libnetwork/iptables"
+ "github.com/docker/libnetwork/portallocator"
+)
+
+// PortMapper manages the network address translation
+type PortMapper struct {
+ bridgeName string
+
+ // udp:ip:port
+ currentMappings map[string]*mapping
+ lock sync.Mutex
+
+ proxyPath string
+
+ Allocator *portallocator.PortAllocator
+ chain *iptables.ChainInfo
+}
+
+// SetIptablesChain sets the specified chain into portmapper
+func (pm *PortMapper) SetIptablesChain(c *iptables.ChainInfo, bridgeName
string) {
+ pm.chain = c
+ pm.bridgeName = bridgeName
+}
+
+// AppendForwardingTableEntry adds a port mapping to the forwarding table
+func (pm *PortMapper) AppendForwardingTableEntry(proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
+ return pm.forward(iptables.Append, proto, sourceIP, sourcePort,
containerIP, containerPort)
+}
+
+// DeleteForwardingTableEntry removes a port mapping from the forwarding table
+func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
+ return pm.forward(iptables.Delete, proto, sourceIP, sourcePort,
containerIP, containerPort)
+}
+
+func (pm *PortMapper) forward(action iptables.Action, proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
+ if pm.chain == nil {
+ return nil
+ }
+ return pm.chain.Forward(action, sourceIP, sourcePort, proto,
containerIP, containerPort, pm.bridgeName)
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/mapper_windows.go
1970-01-01 01:00:00.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/mapper_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -0,0 +1,31 @@
+package portmapper
+
+import (
+ "net"
+ "sync"
+
+ "github.com/docker/libnetwork/portallocator"
+)
+
+// PortMapper manages the network address translation
+type PortMapper struct {
+ bridgeName string
+
+ // udp:ip:port
+ currentMappings map[string]*mapping
+ lock sync.Mutex
+
+ proxyPath string
+
+ Allocator *portallocator.PortAllocator
+}
+
+// AppendForwardingTableEntry adds a port mapping to the forwarding table
+func (pm *PortMapper) AppendForwardingTableEntry(proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
+ return nil
+}
+
+// DeleteForwardingTableEntry removes a port mapping from the forwarding table
+func (pm *PortMapper) DeleteForwardingTableEntry(proto string, sourceIP
net.IP, sourcePort int, containerIP string, containerPort int) error {
+ return nil
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/proxy_windows.go
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/proxy_windows.go
---
old/libnetwork-git.2cfbf9b1f98162a55829a21cc603c76072a75382/portmapper/proxy_windows.go
1970-01-01 01:00:00.000000000 +0100
+++
new/libnetwork-git.872f0a83c98add6cae255c8859e29532febc0039/portmapper/proxy_windows.go
2019-04-23 18:19:33.000000000 +0200
@@ -0,0 +1,10 @@
+package portmapper
+
+import (
+ "errors"
+ "net"
+)
+
+func newProxyCommand(proto string, hostIP net.IP, hostPort int, containerIP
net.IP, containerPort int, proxyPath string) (userlandProxy, error) {
+ return nil, errors.New("proxy is unsupported on windows")
+}