vendor: update libnetwork 1a17fb36132631a95fe6bb055b91e24a516ad81d

full diff: ef149a924d...1a17fb3613

- docker/libnetwork#2538 produce an error with invalid address pool
    - addresses docker/docker#40388 dockerd ignores the --default-address-pool option
- docker/libnetwork#2471 DOCKER-USER chain not created when IPTableEnable=false
- docker/libnetwork#2544 Fix NPE due to null value returned by ep.Iface()
    - carries docker/libnetwork#2239 Prevent NPE in addServiceInfoToCluster()
    - addresses docker/docker#37506 Error initializing docker.server while starting daemon by systemd

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-04-10 20:33:43 +02:00
parent ba8129b28a
commit c3808634e7
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
7 changed files with 54 additions and 18 deletions

View File

@ -39,7 +39,7 @@ github.com/gofrs/flock 392e7fae8f1b0bdbd67dad7237d2
# libnetwork
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
github.com/docker/libnetwork ef149a924dfde2e506ea3cb3f617d7d0fa96b8ee
github.com/docker/libnetwork 1a17fb36132631a95fe6bb055b91e24a516ad81d
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

View File

@ -596,7 +596,7 @@ func (ep *endpoint) deleteDriverInfoFromCluster() 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
}
@ -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 != "" {
// This is a task part of a service
var ingressPorts []*PortConfig

View File

@ -67,6 +67,7 @@ import (
"github.com/docker/libnetwork/hostdiscovery"
"github.com/docker/libnetwork/ipamapi"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
"github.com/docker/libnetwork/osl"
"github.com/docker/libnetwork/types"
"github.com/pkg/errors"
@ -252,6 +253,7 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
return nil, err
}
setupArrangeUserFilterRule(c)
return c, nil
}
@ -909,8 +911,7 @@ addToStore:
arrangeIngressFilterRule()
c.Unlock()
}
c.arrangeUserFilterRule()
arrangeUserFilterRule()
return network, nil
}
@ -979,6 +980,10 @@ func (c *controller) reservePools() {
continue
}
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 {
logrus.Warnf("Failed to reserve current address for endpoint %q (%s) on network %q (%s)",
ep.Name(), ep.ID(), n.Name(), n.ID())
@ -1363,3 +1368,27 @@ func (c *controller) IsDiagnosticEnabled() bool {
defer c.Unlock()
return c.DiagnosticServer.IsDiagnosticEnabled()
}
func (c *controller) iptablesEnabled() bool {
c.Lock()
defer c.Unlock()
if c.cfg == nil {
return false
}
// parse map cfg["bridge"]["generic"]["EnableIPTable"]
cfgBridge, ok := c.cfg.Daemon.DriverCfg["bridge"].(map[string]interface{})
if !ok {
return false
}
cfgGeneric, ok := cfgBridge[netlabel.GenericData].(options.Generic)
if !ok {
return false
}
enabled, ok := cfgGeneric["EnableIPTables"].(bool)
if !ok {
// unless user explicitly stated, assume iptable is enabled
enabled = true
}
return enabled
}

View File

@ -7,21 +7,25 @@ import (
const userChain = "DOCKER-USER"
func (c *controller) arrangeUserFilterRule() {
c.Lock()
arrangeUserFilterRule()
c.Unlock()
iptables.OnReloaded(func() {
c.Lock()
arrangeUserFilterRule()
c.Unlock()
})
var (
ctrl *controller = nil
)
func setupArrangeUserFilterRule(c *controller) {
ctrl = c
iptables.OnReloaded(arrangeUserFilterRule)
}
// 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
// rules from the DOCKER-USER filter chain.
// Note once DOCKER-USER chain is created, docker engine does not remove it when
// IPTableForwarding is disabled, because it contains rules configured by user that
// are beyond docker engine's control.
func arrangeUserFilterRule() {
if ctrl == nil || !ctrl.iptablesEnabled() {
return
}
_, err := iptables.NewChain(userChain, iptables.Filter, false)
if err != nil {
logrus.Warnf("Failed to create %s chain: %v", userChain, err)

View File

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

View File

@ -35,7 +35,10 @@ func Init(ic ipamapi.Callback, l, g interface{}) error {
}
}
ipamutils.ConfigLocalScopeDefaultNetworks(GetDefaultIPAddressPool())
err := ipamutils.ConfigLocalScopeDefaultNetworks(GetDefaultIPAddressPool())
if err != nil {
return err
}
a, err := ipam.NewAllocator(localDs, globalDs)
if err != nil {

View File

@ -1329,7 +1329,7 @@ func (n *network) EndpointByID(id string) (Endpoint, error) {
func (n *network) updateSvcRecord(ep *endpoint, localEps []*endpoint, isAdd bool) {
var ipv6 net.IP
epName := ep.Name()
if iface := ep.Iface(); iface.Address() != nil {
if iface := ep.Iface(); iface != nil && iface.Address() != nil {
myAliases := ep.MyAliases()
if iface.AddressIPv6() != nil {
ipv6 = iface.AddressIPv6().IP