Commit graph

2486 commits

Author SHA1 Message Date
Pavel Matěja
66a82d7268 Log when endpoint joins internal macvlan network
Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2019-07-16 14:50:08 +02:00
Arko Dasgupta
ddd22a8198 Support dockerd and system restarts for ipvlan and macvlan networks
This commit carries forward the work done in
https://github.com/docker/libnetwork/pull/2295
and fixes two things
1. Allows macvlan and ipvlan to be restored properly
after dockerd or the system is restarted
2. Makes sure the refcount for the configOnly network
is not incremented for the above case so this network
can be deleted after all the associated ConfigFrom networks
are deleted

Addresses: https://github.com/docker/libnetwork/issues/1743

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-07-15 15:37:21 -07:00
elangovan sivanandam
d07c890b48 Merge pull request #2414 from lemrouch/2413-fix
Allow network with --config-from to be --internal
2019-07-15 16:24:19 -04:00
elangovan sivanandam
43b7bc99dc Merge pull request #2411 from lemrouch/2410-fix
Macvlan network handles netlabel.Internal wrong
2019-07-15 12:37:29 -04:00
Pavel Matěja
12a182e937 Ipvlan network handles netlabel.Internal wrong
check value of netlabel.Internal not just it's existence

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2019-07-15 10:15:53 +02:00
Tim Wagner
d132acb485 Fix hardcoded AF_INET for IPv6 address handling
Signed-off-by: Tim Wagner <tim.wagner@freenet.ag>
2019-07-11 08:22:10 +02:00
Pavel Matěja
afcb9fb299 Allow network with --config-from to be --internal
The --internal netlabel is discarded now.

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2019-07-08 15:34:08 +02:00
Tibor Vass
ecc7bd0540 vendor: update netns to 7109fa855
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-27 22:26:46 +00:00
Pavel Matěja
e5353649f6 Macvlan network handles netlabel.Internal wrong
check value of netlabel.Internal not just it's existence

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2019-06-27 15:53:57 +02:00
Euan Harris
46bed879da Merge pull request #2231 from msabansal/winnetwork
Add support for Internal and Private network types on windows
2019-06-27 11:23:32 +01:00
Euan Harris
587783fb82 Merge pull request #1656 from huikang/remove-unused-testcode
Removed unused integration test code
2019-06-27 09:57:12 +01:00
Euan Harris
3eeda3d91c Dockerfile: Update to Go 1.12.6, matching moby/moby
Signed-off-by: Euan Harris <euan.harris@docker.com>
2019-06-26 16:54:53 +01:00
Euan Harris
84414583f0 gofmt: Fix formatting warnings
Signed-off-by: Euan Harris <euan.harris@docker.com>
2019-06-26 16:54:31 +01:00
Euan Harris
746e680871 vet: Fix format string warnings
Signed-off-by: Euan Harris <euan.harris@docker.com>
2019-06-26 16:51:22 +01:00
Euan Harris
0275b007c6 vet: Fix composite literal uses unkeyed fields warnings
Signed-off-by: Euan Harris <euan.harris@docker.com>
2019-06-26 16:50:56 +01:00
Pavel Matěja
e2b2318e14 Macvlan internal network shouldln't change gw
Since docker container can be connected to combination of several
internal and external networks change of default gateway of the internal
ones breaks communication via the external ones.

This fixes only macvlan network type

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2019-06-26 14:23:51 +02:00
Tonis Tiigi
75bc82fe5c bridge: add riscv64 build tags
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-06-26 11:11:15 +08:00
Euan Harris
5c8048b363 Merge pull request #2404 from smarkm/master
Remove roadmap link from README.md
2019-06-25 15:24:14 +01:00
Euan Harris
1e476e7de6 Merge pull request #2365 from thaJeztah/fix_loadIPAMDriver_error_handling
controller.loadIPAMDriver: Unwrap error type returned by PluginGetter
2019-06-25 15:15:45 +01:00
Euan Harris
c3d402cef3 Merge pull request #2403 from thaJeztah/carry_2370_sctp_update
[carry 2370] Update sctp package
2019-06-25 15:11:50 +01:00
Euan Harris
d297a25283 Merge pull request #1723 from sebradloff/patch-1
Change wording for Endpoint description
2019-06-25 15:09:04 +01:00
Euan Harris
c0c586aacb Merge pull request #2279 from mrbeskin/clarify-design-doc
clarifications and typo fixes for the design documentation
2019-06-25 15:07:57 +01:00
Smark
1f1d9898c9 road map loss tracing, just keep use 'Design' describe the 'Future'
Signed-off-by: Smark <smark@freecoop.net>
2019-06-25 22:06:30 +08:00
Sascha Grunert
c5c8653912 Update sctp package
This commit updates the vendored ishidawataru/sctp and adapts its used
types.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-24 17:26:33 +02:00
Sebastiaan van Stijn
1425fd4fcc controller.loadIPAMDriver: Unwrap error type returned by PluginGetter
moby/moby commit b27f70d45 wraps the ErrNotFound error returned when
a plugin cannot be found, to include a backtrace.   This changes the
type of the error, so contoller.loadIPAMDriver no longer converts it
to a libnetwork plugin.NotFoundError.

This is a similar patch as was merged in 9b114971e5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-24 16:40:51 +02:00
Euan Harris
d9ac962114 Merge pull request #2396 from mavenugo/um
Maintainers update
2019-06-24 15:25:30 +01:00
Sebastiaan van Stijn
e9e18d993c bump github.com/vishvananda/netns 13995c7128ccc8e51e9a6bd2b551020a27180abd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-24 14:56:52 +02:00
Sebastiaan van Stijn
d152888722 Bump vishvananda/netlink to 1.0.0
Changes included:

- Allow index specification at link creation time
- replace syscall with golang.org/x/sys/unix
  - related: Use IFF_MULTI_QUEUE from x/sys/unix to define TUNTAP_MULTI_QUEUE
  - related: Use IFLA_* constants from x/sys/unix
- Fix index out of range when no metadata for gretap
- added encapsulation attributes for Iptun and Sittun to support SIT tunnels
- Expose xfrm state's statistics
- Support invert in ip rules
- Support LWTUNNEL_ENCAP_SEG6
- Support setting and retrieving route MTU/AdvMSS
- Fix CalcRtable array parameter bug
- added support for Foo-over-UDP netlink calls
- Support num{tx,rx}queues and udp6zerocsum{tx,rx}
- tuntap: Add multiqueue support
- Retrieve VLAN ID when listing neighbour
- Fix LinkAdd for sit tunnel on 3.10 kernel
- Add support for managing source MACVLANs
- Two functions: one for adding bond slave, one for getting veth peer index
- Eliminate cgo from netlink
- Don't overwrite the XDP file descriptor with flags
- Fix reference to BPF instructions (on Kernel 4.13)
- Add Matchall filter
- Send IFA_CACHEINFO when setting up addresses
- Support IPv6 GRE Tun and Tap
- Add List option to RouteSubscribeWithOptions, AddrSubscribeWithOptions, and LinkSubscribeWithOptions
- Add Fq and Fq_Codel Qdisc support

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-24 14:56:49 +02:00
Euan Harris
97d292bf26 Merge pull request #2361 from thaJeztah/bump_engine
Reformat vendor.conf, update docker/docker and dependencies
2019-06-24 08:47:51 +01:00
Madhu Venugopal
0fce3b3653 Maintainers update
- Add Euan and Elango
- Remove inactive maintainers

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2019-06-21 14:27:00 -07:00
Euan Harris
8d76333719 Merge pull request #2339 from phyber/iptables-check
controller: Check if IPTables is enabled for arrangeUserFilterRule
2019-06-21 17:31:52 +01:00
Arko Dasgupta
313d2b8a74 Make DNS records and queries case-insensitive
RFC434 states that DNS Servers should be case insensitive
    This commit makes sure that all DNS queries will be translated
    to lower ASCII characters and all svcRecords will be saved in
    lower case to abide by the RFC

    Relates to https://github.com/moby/moby/issues/21169

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-06-19 11:23:31 -07:00
Euan Harris
a926e65406 Merge pull request #2364 from thaJeztah/fix_TestValidRemoteDriver
Fix TestValidRemoteDriver GetCapabilities errors
2019-06-14 17:13:23 +01:00
Madhu Venugopal
fc69adf859 Merge pull request #2372 from xinfengliu/improve-support.sh
add checks on node LB in support.sh
2019-06-04 09:22:10 -07:00
Tibor Vass
631ee43f1b Merge pull request #2373 from arkodg/ungraceful-exit-config-from-net-clean
Clean up --config-only networks after --config-from networks have ungracefully exited
2019-06-04 08:46:31 -07:00
Tibor Vass
599e037a24 remove gosimple - package is gone and it's not important
Also fixes issue reported by ineffassign

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-04 04:50:37 +00:00
Tibor Vass
c575631528 resolvconf: use /run/systemd/resolve/resolv.conf if systemd-resolved manages DNS
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-04 04:50:37 +00:00
Sebastiaan van Stijn
e9bd147bb7 Add Delete endpoint for plugin in test
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-23 14:55:29 +02:00
Sebastiaan van Stijn
cc38e3a35c Fix TestValidRemoteDriver GetCapabilities errors
This test was producing error messages due to missing endpoints
in the plugin API;

```
=== RUN   TestValidRemoteDriver
ERRO[0039] error getting capability for valid-network-driver due to NetworkDriver.GetCapabilities: 404 page not found
 ```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-23 14:55:20 +02:00
Tomas Janousek
6038ef390d bridge: Fix hwaddr set race between us and udev
systemd and udev in their default configuration attempt to set a
persistent MAC address for network interfaces that don't have one
already [systemd-def-link]. We set the address only after creating the
interface, so there is a race between us and udev. There are several
outcomes (that actually occur, this race is very much not a theoretical
one):

* We set the address before udev gets to the networking rules, so udev
  sees `/sys/devices/virtual/net/docker0/addr_assign_type = 3`
  (NET_ADDR_SET). This means there's no need to assign a different
  address and everything is fine.

* udev reads `/sys/devices/virtual/net/docker0/addr_assign_type` before
  we set the address, gets `1` (NET_ADDR_RANDOM), and proceeds to
  generate and set a persistent address.

  Old versions of udev (pre-v242, i.e. without [udev-patch]) would then
  fail to generate an address, spit out "Could not generate persistent
  MAC address for docker0: No such file or directory" (see [udev-issue],
  and everything would be probably fine as well.

  Current version of udev (with [udev-patch]) will generate an address
  just fine and then race us setting it. As udev does more work than we,
  the most probable outcome is that udev will overwrite the address we
  set and possibly cause some trouble later on.

On a clean Debian Buster (from Vagrant) VM with systemd/udev 242 from
Debian Experimental, `docker network create net1` up to `net7` resulted
in 3 bridges having a 02:42: address and 4 bridges having a seemingly
random (actually generated from interface name) address. With systemd
241, the result would be all bridges having a 02:42:, but some "Could
not generate persistent MAC address for" messages in the log.

The fix is to revert the MAC address setting fix from 6901ea51dc,
as it is no longer necessary with current netlink [netlink-addr-add],
and set the address atomically when creating the bridge interface, not
after that.

[systemd-def-link]: a166cd3aac/network/99-default.link
[udev-patch]: 6d36464065
[udev-issue]: https://github.com/systemd/systemd/issues/3374
[netlink-addr-add]: 7d9b424492

...

Do note that a similar race happens when creating veth devices as well.
I wasn't able to reproduce getting a wrong (non-02:42:) address,
possibly because the address is set by docker later, maybe only after
the interface is moved to another network namespace (but I'm just
guessing here). Still, different timings result in various error
messages being logged ("link_config: could not get ethtool features for
vethd9c938e" and the like) depending on when the interface disappears
from the primary network namespace. I'm not sure how to fix this and I
don't intend to dig deeper into this.

Signed-off-by: Tomas Janousek <tomi@nomi.cz>
2019-05-19 19:38:35 +02:00
Arko Dasgupta
ee574c1b7d Correctly clean up --config-only networks
The endpoint count for --config-only networks
was being incremented even when the respective --config-from
inherited network failed to create a network

This was due to a variable shadowing problem with err causing
the deferred function to not execute correctly.

Using the same err variable across the entire function fixes
the issue

Fixes: moby/moby#35101

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-05-14 10:20:14 -07:00
Pradip Dhara
a04a30717e Forcing a nil IP specified in PortBindings to IPv4zero (0.0.0.0).
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
2019-05-13 15:42:32 -07:00
Xinfeng Liu
74013a3899 add check on node LB in support.sh
Starting from 18.09, there's a per node LB for each overlay
network, this change adds the check to node LB.
This change should not break on older docker versions.

Signed-off-by: Xinfeng Liu <xinfeng.liu@gmail.com>
2019-05-07 16:45:01 +08:00
David O'Rourke
301a7724fb Move hasIPTablesEnabled check into firewall_linux.go
Signed-off-by: David O'Rourke <david@scalefactory.com>
2019-04-29 13:51:15 +01:00
David O'Rourke
b4d0319424 controller: Check if IPTables is enabled for arrangeUserFilterRule
This allows the `--iptables=false` argument to the `dockerd` to actually
work.

Signed-off-by: David O'Rourke <david@scalefactory.com>
2019-04-29 13:27:01 +01:00
Pradip Dhara
1909ecb27a Pick a random host port if the user does not specify a host port.
For overlay, l2bridge, and l2tunnel, if the user does not specify a host port, windows driver will select a random port for them.  This matches linux behavior.
For ics and nat networks the windows OS will choose the port.

Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
2019-04-22 17:43:27 +00:00
Danny Milosavljevic
6b5dc55e93 Use fewer modprobes
Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2019-04-10 17:32:39 +02:00
Sebastiaan van Stijn
6ee0b5fcd8 update docker/docker and dependencies
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-08 12:09:49 +02:00
Sebastiaan van Stijn
0b40402976 Reformat vendor.conf for readability, pin to git-sha's
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-08 11:55:15 +02:00
Sebastiaan van Stijn
f126923aeb re-vendor with current version of LK4D4/vndr
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-08 11:50:39 +02:00
Madhu Venugopal
5c6423fb29 Adding error log if peerAdd fails
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2019-04-05 20:31:17 -07:00
Pradip Dhara
94ab7b2df6 Adding synchronization to endpoint addition/deletion to prevent network connectivity issue
Signed-off-by: Pradip Dhara <pradipd@microsoft.com>
2019-04-05 14:19:19 -07:00
Sebastiaan van Stijn
5ae7f4daf7 Use errors.Wrap to preserve original error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-04-01 20:14:54 +02:00
Flavio Crisciani
2b1e45c682 Merge pull request #2238 from talex5/networkdb-docs
Add NetworkDB docs
2019-03-14 16:05:31 -07:00
Laurent Bernaille
efeae5e7ee [ipvs] Add SetConfig test with timeout=0
Signed-off-by: Laurent Bernaille <laurent.bernaille@datadoghq.com>
2019-03-13 21:43:01 +01:00
Laurent Bernaille
8e650a9685 [ipvs] Add tests for get/set timeout
Signed-off-by: Laurent Bernaille <laurent.bernaille@datadoghq.com>
2019-03-13 21:02:19 +01:00
Laurent Bernaille
7374284841 [ipvs] Add support for timeout configuration (Get/SetConfig)
Signed-off-by: Laurent Bernaille <laurent.bernaille@datadoghq.com>
2019-03-13 21:02:16 +01:00
Arko Dasgupta
068ca7d046 Revert "debian has iptables-legacy and iptables-nft now"
This reverts commit 7adcd856fe.

Libnetwork should only use the iptables binary. Iptables v1.8 and above
uses the nftables backend. The translations for all the rules used by
libnetwork is supported by the new iptables binary.

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-03-01 11:50:47 -08:00
Flavio Crisciani
8e7aead94f Merge pull request #2230 from mavenugo/exp-ipv
Moving IPVLAN driver out of experimental
2019-02-28 16:28:24 -08:00
Ryoga
e744b62f49 Update setup_ip_forwarding.go
Signed-off-by: Ryoga Saito <proelbtn@users.noreply.github.com>
2019-02-26 13:30:01 +09:00
Kyle Wuolle
7ca0bc66d3 Cleanup the cluster provider when the agent is closed
Signed-off-by: Kyle Wuolle <kyle.wuolle@gmail.com>
2019-01-25 08:36:28 -08:00
Sebastiaan van Stijn
916927d970 Bump Go to 1.10.7
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-23 21:12:12 +01:00
Flavio Crisciani
a52a6ba44e Merge pull request #2303 from thaJeztah/docs_and_error_touchup
Touch-up error-message and godoc for ConfigVXLANUDPPort
2019-01-23 09:42:36 -08:00
Sebastiaan van Stijn
d7f397c236 Touch-up error-message and godoc for ConfigVXLANUDPPort
Minor changes following review of the engine pull request
for this feature;

- Remove the name of the function from the error message
  as it's not a debug message.
- Add the valid range to the error message, so that a
  user has sufficient information to address the problem.
- Update GoDoc for the function to describe the default
  port, and valid port-ranges.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-01-23 10:56:40 +01:00
Flavio Crisciani
151f42aeaa Fix possible nil pointer exception
It is possible that the node is not yet present in
the node list map. In this case just print a warning
and return. The next iteration would be fine

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2019-01-22 17:07:15 -08:00
Flavio Crisciani
d418337502 Fix gosimple
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2019-01-03 15:25:37 -08:00
Flavio Crisciani
25949f1470 Merge pull request #2302 from thaJeztah/vxlan_locking
Use sync.RWMutex for VXLANUDPPort
2019-01-03 11:12:26 -08:00
Flavio Crisciani
9b597f983f Merge pull request #2306 from qudongfang/add_more_details_to_no-available-network_error
Improve error if auto-selecting IP-range failed
2019-01-03 11:11:05 -08:00
Gabriel L. Somlo
10027e8c01 Allow bridge net driver to skip IPv4 configuration of bridge interface
Introduce "com.docker.network.bridge.inhibit_ipv4" option to the bridge
network driver. If set, this option will prevent docker from setting or
modifying Layer-3 (IP) configuration on the bridge interface in any way.

This option should allow connecting containers to pre-existing network
segments (with e.g., pre-existing default gateways) while simultaneously
preserving our ability to communicate with the host and/or configure the
properties of the host-side container virtual network interface (e.g.,
delay/loss/jitter via netem), which can not be done using macvlan.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2018-12-23 19:05:20 -05:00
Olli Janatuinen
ef2741452c Removed roadmap
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-12-19 12:52:52 +02:00
Flavio Crisciani
33d47f95e8 Build with latest docker stable engine
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-12-10 08:36:52 -08:00
Andrew Hsu
5338928eb8 account for removal of configs.HookState
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2018-12-07 01:47:05 +00:00
Andrew Hsu
bb3ae82008 vndr runc 96ec217
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2018-12-07 01:46:14 +00:00
Flavio Crisciani
2dc04ddf4f Merge pull request #2299 from olljanat/ip-to-hostname-fix
Do not add IP to name records for aliases
2018-11-29 08:16:29 -08:00
qudongfang
03b2393a80 Improve error if auto-selecting IP-range failed.
Signed-off-by: qudongfang <qudongfang@gmail.com>
2018-11-28 15:57:45 +08:00
Sebastiaan van Stijn
38c8a3f84d Use sync.RWMutex for VXLANUDPPort
Looks like concurrent reads should be possible, so use
a RWMutex instead of Mutex.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-11-22 21:29:20 +01:00
Flavio Crisciani
7667c0a4b2 Merge pull request #2300 from selansen/master
VXLAN port configuration - late review comments update
2018-11-15 08:25:45 -07:00
selansen
56ca280b27 VXLAN port configuration - late review comments update
Some review comments came in very late after merging
	#2282. This PR addresses those review comments.

Signed-off-by: selansen <elango.siva@docker.com>
2018-11-14 13:26:56 -05:00
Olli Janatuinen
d635844ed7 Do not add IP to Name records for aliases
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2018-11-10 20:53:06 +02:00
Flavio Crisciani
ffa1330066 Merge pull request #2282 from selansen/master
VXLAN UDP Port configuration support
2018-11-05 07:41:26 -08:00
selansen
077ccabc45 VXLAN UDP Port configuration support
This PR chnages allow user to configure VxLAN UDP
port number. By default we use 4789 port number. But this commit
will allow user to configure port number during swarm init.
VxLAN port can't be modified after swarm init.

Signed-off-by: selansen <elango.siva@docker.com>
2018-11-01 15:20:30 -04:00
Flavio Crisciani
2d1311fc1b Merge pull request #2290 from fcrisciani/golint
Update golint tool
2018-11-01 10:21:34 -07:00
Flavio Crisciani
387aed91bf Update golint tool
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-11-01 10:09:47 -07:00
Nathan Herald
7adcd856fe debian has iptables-legacy and iptables-nft now
Signed-off-by: Nathan Herald <me@nathanherald.com>
2018-10-31 09:14:35 -07:00
mrbeskin
1caeac8b64 clarifications and typo fixes for the design documentation
Signed-off-by: mrbeskin <mrbeskin@gmail.com>
2018-10-21 15:43:25 -05:00
Flavio Crisciani
cbf4d5ce89 Merge pull request #2171 from thaJeztah/dont_give_up
Handle NXDOMAIN, REFUSED and log errors
2018-10-12 08:38:25 -07:00
Flavio Crisciani
e0d1cdd3d4 Merge pull request #2270 from ctelfer/lbdsr
Use direct server return in east-west overlay load balancing
2018-10-11 17:44:44 -07:00
Sebastiaan van Stijn
6dd3f45248 Handle NXDOMAIN, REFUSED and log errors
- NXDOMAIN is an authoritive answer, so when receiving an NXDOMAIN, we're done.
  From RFC 1035: Name Error - Meaningful only for responses from an authoritative
  name server, this code signifies that the domain name referenced in the query
  does not exist.
  FROM RFC 8020: When an iterative caching DNS resolver receives an NXDOMAIN
  response, it SHOULD store it in its cache and then all names and resource
  record sets (RRsets) at or below that node SHOULD be considered unreachable.
  Subsequent queries for such names SHOULD elicit an NXDOMAIN response.
- REFUSED can be a transitional status: (https://www.ietf.org/rfc/rfc1035.txt)
  The name server refuses to perform the specified operation for
  policy reasons.  For example, a name server may not wish to provide the
  information to the particular requester, or a name server may not wish to
  perform a particular operation (e.g., zone)

Other errors are now logged as debug-message, which can be useful for
troubleshooting.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-12 00:55:36 +02:00
Sebastiaan van Stijn
a72bff0da3 Remove if/else and redundant brackets in resolver
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-12 00:55:28 +02:00
Christopher Adam Telfer
466225b792 Merge pull request #2276 from amoghe/amoghe_dest_stats
Add destination stats extraction to IPVS library
2018-10-11 18:01:20 -04:00
Chris Telfer
013ca3bdf8 Make DSR an overlay-specific driver "option"
Allow DSR to be a configurable option through a generic option to the
overlay driver.  On the one hand this approach makes sense insofar as
only overlay networks can currently perform load balancing.  On the
other hand, this approach has several issues.  First, should we create
another type of swarm scope network, this will prevent it working.
Second, the service core code is separate from the driver code and the
driver code can't influence the core data structures.  So the driver
code can't set this option itself.  Therefore, implementing in this way
requires some hack code to test for this option in
controller.NewNetwork.

A more correct approach would be to make this a generic option for any
network.  Then the driver could ignore, reject or be unaware of the option
depending on the chosen model.  This would require changes to:
  * libnetwork - naturally
  * the docker API - to carry the option
  * swarmkit - to propagate the option
  * the docker CLI - to support the option
  * moby - to translate the API option into a libnetwork option
Given the urgency of requests to address this issue, this approach will
be saved for a future iteration.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-10-11 14:13:19 -04:00
Chris Telfer
9a2464f436 Set east-west load balancing to use direct routing
Modify the loadbalancing for east-west traffic to use direct routing
rather than NAT and update tasks to use direct service return under
linux.  This avoids hiding the source address of the sender and improves
the performance in single-client/single-server tests.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-10-11 14:13:19 -04:00
Akshay
0922883b7e Add a DstStats type to track Destination (real server) stats
Since SvcStats represents the stats for a `Service`, we don't want
to reuse that struct in the `Destination` (for no other reason than
incompatible nomenclature). So this patch adds a `DstStats` struct
to hold the Destination stats.
2018-10-10 13:42:59 -07:00
Akshay
e427c4ee2e Add Stats to the Destination
This patch modifies the `Destination` struct so that the stats for
that destination are also reported.

Signed-off-by: Akshay <akshay.moghe@gmail.com>
2018-10-09 11:53:12 -07:00
Flavio Crisciani
7c3d556f8b Merge pull request #2262 from trilogy-group/increase-dns-max-concurrent
Increase max concurrent requests for DNS from 100 to 1024
2018-10-09 08:02:08 -07:00
John Stephens
4fd54c2aea Do not fail with an empty transparent IPv4 address
When dockerd.exe is not stopped cleanly (such as when Windows is
restarted), the endpoints are not cleaned up. When using a transparent
network, the endpoint IPv4 address is blank. When dockerd.exe starts up
again, libnetwork restores the endpoint, which would not have been
stored on a clean shutdown of dockerd.exe. That fails because the IPv4
address is blank. This change warns instead of failing.

Signed-off-by: John Stephens <johnstep@docker.com>
2018-09-27 12:30:37 -07:00
Yongxin Li
619e3d6706 typo fix about mismatch
Signed-off-by: Yongxin Li <yxli@alauda.io>
2018-09-27 20:43:13 +08:00
Madhu Venugopal
08796e04ea Removing experimental driver interface
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2018-09-25 10:30:56 -07:00
Madhu Venugopal
f7b7e74624 Moving IPVLAN driver out of experimental
IPVLAN driver had been retained in experimental for multiple releases
with the requirement to have a proper L3 control-plane (such as BGP) to
go along with it which will make this driver much more useful. But
based on the community feedback,
https://github.com/moby/moby/issues/21735, am proposing to move this
driver out of experimental.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2018-09-25 10:30:56 -07:00
Akihiro Suda
ce5bc0079b allow propagating custom exec-root (e.g. "/run/docker") to libnetwork-setkey
The docker daemon needs to be modified as follows:

    diff --git a/daemon/oci_linux.go b/daemon/oci_linux.go
    index 00ace320df..ea7daa72df 100644
    --- a/daemon/oci_linux.go
    +++ b/daemon/oci_linux.go
    @@ -809,7 +809,7 @@ func (daemon *Daemon) createSpec(c *container.Container) (retSpec *specs.Spec, e
                        s.Hooks = &specs.Hooks{
                                Prestart: []specs.Hook{{
                                        Path: target,
    -                                   Args: []string{"libnetwork-setkey", c.ID, daemon.netController.ID()},
    +                                   Args: []string{"libnetwork-setkey", c.ID, daemon.netController.ID(), "-exec-root="+daemon.configStore.GetExecRoot()},
                                }},
                        }
                }

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-09-14 14:09:09 +09:00
Christopher Adam Telfer
e1b464e78f Merge pull request #2268 from jhowardmsft/boltdb
boltdb/bolt==>bbolt, revendor Microsoft/*, Windows compilation.
2018-09-13 16:00:09 -04:00
John Howard
55b80035ed Don't build portallocator on Windows
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-13 09:20:03 -07:00
John Howard
40b6ebfe75 Add init_windows.go for compilation
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-13 09:20:03 -07:00
John Howard
44094fae9f Remove unused syndtr/gocapability from vendor.conf
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-13 09:20:03 -07:00
John Howard
9ca55c7a60 Bump libkv to 458977154600b9f23984d9f4b82e79570b5ae12b
Signed-off-by: John Howard <jhoward@microsoft.com>

As well as bumping, libkv now requires go.etcd.io/bolt rather
than boltdb/bolt. Hence removed bolt from vendor.conf,
vendored go.etcd.io/bbot @ v1.3.1-etcd.8 and rerun vndr.
2018-09-13 09:20:03 -07:00
Rui Cao
65860893bf Fix typo: assigment -> assignment
Signed-off-by: Rui Cao <ruicao@alauda.io>
2018-09-13 09:59:39 +08:00
John Howard
a906968a3f Bump Microsoft/go-winio to v0.4.11
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-12 14:05:23 -07:00
John Howard
c15a478047 Bump Microsoft/hcsshim to v0.7.3
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-12 14:05:04 -07:00
Christopher Adam Telfer
33eca9a291 Merge pull request #2069 from fanjiyun/1-Rolling-back-the-port-configs
Roll back the port configurations upon failure within programIngress()
2018-09-11 14:02:59 -04:00
Thiago Alves Silva
d642cfdeb6 Increase max concurrent requests for DNS from 100 to 1000
This addresses/alleviates https://github.com/docker/libnetwork/issues/2214

The new proposed limit should remediate the issue for most users.

Signed-off-by: Thiago Alves Silva <thiago.alves@aurea.com>
2018-09-11 09:08:58 -03:00
fanjiyun
03ba96c5cf Rolling back the port configs if failed to programIngress()
Signed-off-by: fanjiyun <fan.jiyun@zte.com.cn>
2018-09-11 19:10:59 +08:00
Flavio Crisciani
79074c268f Merge pull request #2266 from riverzhang/typo
Fix some typos
2018-09-08 11:16:35 -07:00
Lei Gong
1adcfa9aa1 fix error when make lint
```
make lint
networkdb/networkdb_test.go:88:2: should replace t.Error(fmt.Sprintf(...)) with t.Errorf(...)
networkdb/networkdb_test.go:136:2: should replace t.Error(fmt.Sprintf(...)) with t.Errorf(...)
make: *** [lint] Error 1
```

Signed-off-by: Lei Gong <lgong@alauda.io>
2018-09-08 21:06:07 +08:00
rongzhang
36375881f3 Fix some typos
Signed-off-by: rongzhang <rongzhang@alauda.io>
2018-09-08 09:33:24 +08:00
Yan Zhu
ce46100a27 doc: fix typo
Signed-off-by: Yan Zhu <yanzhu@alauda.io>
2018-09-07 11:48:15 +08:00
Christopher Adam Telfer
e29452841e Merge pull request #2259 from resin-os/handle-invalid-default-gateways
bridge: fix error handling for stale default gateways
2018-08-30 11:14:22 -04:00
Christopher Adam Telfer
10008597e0 Merge pull request #2077 from quadespresso/master
Added support for Swarm Service Driller (ssd)
2018-08-28 13:35:24 -04:00
Petros Angelatos
72eed906b8 bridge: fix error handling for stale default gateways
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2018-08-24 17:43:12 -07:00
liangwei
99c4c6d5fc ipvs support rs connection information
Signed-off-by: liangwei <liangwei14@huawei.com>
2018-08-22 21:14:26 +08:00
Chris Telfer
afcf6c526d Merge pull request #2253 from selansen/global_add_pool
Add getter functions for Default Address Pools
2018-08-16 16:31:12 -04:00
selansen
814f6c1f4b Add getter function for Default Address Pools
ipamutils has two default address pool. Instead of allowing them to
be accessed directly, adding get functions so that other packages
can use get APIs.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-16 15:48:42 -04:00
Jim Carroll
a478edc819 Added support for Swarm Service Driller (ssd)
Signed-off-by: Jim Carroll <jim.carroll@docker.com>
2018-08-16 14:30:23 -05:00
Madhu Venugopal
bc2180c4b1 Merge pull request #2251 from dani-docker/ssd_image_rename
Move SSD image to docker
2018-08-16 11:20:51 -07:00
selansen
52e85b4b9a Global Default Address Pool support
This change brings global default address pool feature into
libnetwork. Idea is to reuse same code flow and functions that were
implemented for local scope default address pool.
Function InitNetworks carries most of the changes. local scope default
address pool init should always happen only once. But Global scope
default address pool can be initialized multiple times.

Signed-off-by: selansen <elango.siva@docker.com>
2018-08-16 11:28:24 -04:00
Dani Louca
17966c940a Move SSD image to docker
Signed-off-by: Dani Louca <dani.louca@docker.com>
2018-08-14 14:41:33 -04:00
Thomas Leonard
05c05ea5e9 Add NetworkDB docs
This is based on reading the code in the `networkdb` directory.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
2018-08-08 13:35:11 +01:00
Flavio Crisciani
3321709a62 Merge pull request #2242 from euanh/pin-gogoprotobuf
Dockerfile: Install a fixed version of gogoprotobuf
2018-07-26 10:51:42 -07:00
Flavio Crisciani
f9442ee314 Apply load balancer properly
The load balancer options have to be applied
inside the load balancer namespace

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-25 13:51:33 -07:00
Flavio Crisciani
94af1e5af2 Adjust LockOSThread
Go 1.10 fixed the problem related to thread and namespaces.
Details:
2595fe7fb6
In few words there is no more the possibility to have a go routine
running on a thread that is another namespace.
In this commit some cleanup is done and the method SetNamespace is
being removed. This will save tons of setns syscall, that were happening
way too frequently possibily to make sure that each operation was being
done in the host namespace.
I suspect that also all the drivers not running in a different
namespace would be able to drop also the lock of the OS Thread but
will address it in a different commit

Removed useless LockOSThreads around

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-25 13:51:15 -07:00
Flavio Crisciani
92dd7fda05 Merge pull request #2240 from ctelfer/nice-lb-names
Give LB sandboxes predictable names
2018-07-25 10:14:10 -07:00
Chris Telfer
6d27900ffe Merge pull request #2232 from fcrisciani/ubuntu-dns
Proper handling sandbox options
2018-07-25 13:13:05 -04:00
Euan Harris
72905ebb13 Dockerfile: Install a fixed version of gogoprotobuf
This avoids build failures when gogoprotobuf is changed upstream.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-25 15:42:25 +01:00
Chris Telfer
5041b74451 Give LB sandboxes predictable names
Change the sandbox IDs for the sandboxes of load-balancing endpoints to
be "lb_XXXXXXXXX" where XXXXXXXXX is the network ID that this sandbox
load balances for.  This makes it easier to find these sandboxes in
/var/run/docker/netns and thus makes debugging easier.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-24 17:10:41 -04:00
Flavio Crisciani
55ad3ef1a4 Fix handling of the resolv.conf
Leverage what is it passed from the daemon
Fix check about the host networking

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-24 10:18:10 -07:00
Flavio Crisciani
204ce3e31d Create internal directory
Internal directory is designed to contain libraries
that are exclusively used by this project

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-16 17:34:20 -07:00
Thomas Leonard
e88eed1d65 Add required imports to example code in README.md
Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
2018-07-16 14:50:53 +01:00
Sandeep Bansal
012fcea177 Add support for Internal and Private network types on windows
Signed-off-by: Sandeep Bansal <sabansal@microsoft.com>
2018-07-12 13:58:10 -07:00
Flavio Crisciani
8698ad1af1 Merge pull request #2229 from fcrisciani/spelling
Spelling
2018-07-12 13:11:28 -07:00
Flavio Crisciani
6defa7c807 Make protobuf check silent
Avoid printing the if condition

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-12 12:54:59 -07:00
Josh Soref
a06f1b2c4e Spelling fixes
* addresses
* assigned
* at least
* attachments
* auxiliary
* available
* cleanup
* communicate
* communications
* configuration
* connection
* connectivity
* destination
* encountered
* endpoint
* example
* existing
* expansion
* expected
* external
* forwarded
* gateway
* implementations
* implemented
* initialize
* internally
* loses
* message
* network
* occurred
* operational
* origin
* overlapping
* reaper
* redirector
* release
* representation
* resolver
* retrieve
* returns
* sanbdox
* sequence
* succesful
* synchronizing
* update
* validates

Signed-off-by: Josh Soref <jsoref@gmail.com>
2018-07-12 12:54:44 -07:00
Trapier Marshall
b9223019c2 support.sh: also inspect stopped containers
Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
2018-07-12 15:22:42 -04:00
Flavio Crisciani
9db90d27ed Merge pull request #2217 from euanh/protobuf-check
Check that generated protocol buffer code is up to date
2018-07-11 15:12:54 -07:00
Flavio Crisciani
0f593ae92b Merge pull request #2146 from ctelfer/fix-overlay-vxlan-races
Fix overlay vxlan races
2018-07-11 10:41:46 -07:00
Chris Telfer
4e6580c4c1 Refactor locking for join/leave to avoid race
Instead of using "sync.Once" to determine whether to initialize a
network sandbox or subnet sandbox, we use a traditional mutex +
initialization boolean.  This is because the initialization state isn't
truly a once-and-done condition.  Rather, libnetwork destroys network
and subnet sandboxes when the last endpoint leaves them.  The use of
sync.Once in this kind of scenario requires, therefore, re-initializing
the Once which is impoissible.  So the approach that libnetwork
currently takes is to use a pointer to a Once and redirect that pointer
to a new Once on reset.  This leads to nasty race conditions.

In addition to refactoring the locking, this patch merges the functions
joinSandbox(), and joinSubnetSandbox(). This makes the code both cleaner
and it also holds the network and subnet locks through the series of
read-modify-writes avoiding further potential races.  This does reduce
the potential parallelism which could be applied should there be many
joins coming in on many different subnets in the same overlay network.
However, this should be an extremely minor performance hit for a very
obscure case.

One important pattern in this commit is that it is crucial to avoid
sending peerDB messages while holding a driver or network lock.  The
changes herein defer such (asynchronous) notifications until after
release of such locks.  This prevents deadlocks where the peerDB
blocks acquiring said locks while the network method blocks trying
to send to the peerDB's channel.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-10 12:13:39 -04:00
Euan Harris
56c4a6dd3f Makefile: Add check for out of date protocol buffer code
'make check' will now fail if the files produced by re-running protoc
differ from those which are checked into the repository.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
2b602bf3d0 Makefile: Add protobuf-local target, runnable within build container
Outside the build container, run: make protobuf
Inside the build container, run: make protobuf-local

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
3bebfbc34e Makefile: Document and organize into sections
Add documentation and move protobuf target into Build section

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Euan Harris
348ed0a1a8 circleci: Rename 'lint' to 'check' to match build target
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 17:01:48 +01:00
Flavio Crisciani
e353363bab Merge pull request #2228 from euanh/use-init
Makefile: Run containers with --init for proper signal handling
2018-07-10 08:09:09 -07:00
Santhosh Manohar
5fdfa8c52c Cleanup interfaces properly when vxlan plumbling fails
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-10 10:33:46 -04:00
Euan Harris
c699a1215e Makefile: Run containers with --init for proper signal handling
This makes it possible to Ctrl-C tests and builds again.   Zombie
processes will also be reaped correctly.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-10 10:20:44 +01:00
Flavio Crisciani
38ec34e0e7 Merge pull request #2122 from quadespresso/esc-509
Changed loglevel from error to warning
2018-07-06 16:28:11 -07:00
Flavio Crisciani
968b269ec8 Merge pull request #2220 from vdemeester/to-gotest.tools
Migrate to gotest.tools :)
2018-07-06 16:15:13 -07:00
Jim Carroll
9da8e04c70 Updated handling of disable_ipv6 file
Signed-off-by: Jim Carroll <jim.carroll@docker.com>
2018-07-06 16:42:29 -05:00
Flavio Crisciani
e0c5c1b5d3 Merge pull request #2222 from fcrisciani/e2e-test
Create tag for master code
2018-07-06 13:36:29 -07:00
Vincent Demeester
06d471d186 Migrate to gotest.tools :)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-06 11:01:37 -07:00
Vincent Demeester
6c0f597a82 Remove unused deps from vendor.conf
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-07-06 10:40:22 -07:00
Flavio Crisciani
ffe33f932e Create tag for master code
In order to support different branches
create master tag

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-06 10:15:00 -07:00
Flavio Crisciani
b0a0059237 Merge pull request #2216 from fcrisciani/netdb-qlen-issue
NetworkDB qlen optimization
2018-07-05 15:02:58 -07:00
Flavio Crisciani
85862008e9 Merge pull request #2221 from ctelfer/use-fmt-string-precision
Use fmt precision to limit string length
2018-07-05 14:52:49 -07:00
Chris Telfer
06922d2d81 Use fmt precision to limit string length
The previous code used string slices to limit the length of certain
fields like endpoint or sandbox IDs.  This assumes that these strings
are at least as long as the slice length.  Unfortunately, some sandbox
IDs can be smaller than 7 characters.   This fix addresses this issue
by systematically converting format string calls that were taking
fixed-slice arguments to use a precision specifier in the string format
itself.  From the golang fmt package documentation:

    For strings, byte slices and byte arrays, however, precision limits
    the length of the input to be formatted (not the size of the output),
    truncating if necessary. Normally it is measured in runes, but for
    these types when formatted with the %x or %X format it is measured
    in bytes.

This nicely fits the desired behavior: it will limit the number of
runes considered for string interpolation to the precision value.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-07-05 17:44:04 -04:00
Flavio Crisciani
00611a5255 Merge pull request #2215 from hzue/master
Fix error handling about bridgeSetup
2018-07-05 14:34:41 -07:00
hzue
5ef4c59574 Fix error handling about bridgeSetup
Fix the error from bridgeSetup doesn't handle by the defer function in the createNetwork function.

Signed-off-by: Terry Chu <jubosh.tw@gmail.com>
2018-07-05 16:46:56 +08:00
Euan Harris
1383aadf59 ipam: Test rejection of overlapping pool requests
TestOverlappingRequests checks that pool requests which are supersets or
subsets of existing allocations, and those which overlap with existing
allocations at the beginning or the end.

Multiple allocation is now tested by TestOverlappingRequests, so
TestDoublePoolRelease only needs to test double releasing.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-04 09:50:53 +01:00
Euan Harris
6fd25eea33 ipam, types: Expand documentation
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-07-04 09:50:31 +01:00
Flavio Crisciani
a3d24cf4b4 Merge pull request #2219 from fcrisciani/base-image
CircleCI use latest image
2018-07-03 17:45:12 -07:00
Flavio Crisciani
4cbba0da48 CircleCI use latest image
Avoid confusion with the golang versioning

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-03 14:40:57 -07:00
Flavio Crisciani
3788e7949d Merge pull request #2154 from fcrisciani/ipvs-sysctl
Add knobs on LB sandbox
2018-07-03 14:15:46 -07:00
Flavio Crisciani
f857b5b8f8 Merge pull request #2166 from idealhack/tests-benchmark
test: update tests to use sub-benchmarks
2018-07-03 14:06:58 -07:00
Flavio Crisciani
5f670981d9 Merge pull request #2213 from thaJeztah/update_testify
Update stretchr/testify to v1.2.2
2018-07-03 13:25:10 -07:00
Flavio Crisciani
55e4cc7262 Optimize networkDB queue
Added some optimizations to reduce the messages in the queue:
1) on join network the node execute a tcp sync with all the nodes that
it is aware part of the specific network. During this time before the
node was redistributing all the entries. This meant that if the network
had 10K entries the queue of the joining node will jump to 10K. The fix
adds a flag on the network that would avoid to insert any entry in the
queue till the sync happens. Note that right now the flag is set in
a best effort way, there is no real check if at least one of the nodes
succeed.
2) limit the number of messages to redistribute coming from a TCP sync.
Introduced a threshold that limit the number of messages that are
propagated, this will disable this optimization in case of heavy load.

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-02 16:59:45 -07:00
Flavio Crisciani
b09cb39fa5 Enhance testing infra
Allow to write and delete X number of entries
Allow to query the queue length

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-07-02 16:47:34 -07:00
Flavio Crisciani
abc4c5c5d8 Merge pull request #2212 from thaJeztah/fix_duplicate_ndots
Fix duplicate ndots:0, and improve validation
2018-06-29 10:28:22 -07:00
Sebastiaan van Stijn
9295e124bb Update stretchr/testify to v1.2.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:48:39 +02:00
Sebastiaan van Stijn
341845b5f2 ndots: produce error on negative numbers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:22:17 +02:00
Sebastiaan van Stijn
b306706062 improve error message for invalid ndots number
instead of printing the whole option, print the _number_ only,
because that's what the error-message is pointing at;

Before this change:

    invalid number for ndots option ndots:foobar

After this change:

    invalid number for ndots option: foobar

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 01:19:34 +02:00
Flavio Crisciani
7fc1795cdf Allows to set generic knobs on the Sandbox
Refactor the ostweaks file to allows a more easy reuse
Add a method on the osl.Sandbox interface to allow setting
knobs on the sandbox

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-28 16:14:08 -07:00
Flavio Crisciani
ef457321a9 Merge pull request #2200 from fcrisciani/networkdb-retry
Adjust corner case for reconnect logic
2018-06-28 16:00:00 -07:00
Sebastiaan van Stijn
6e260332e8 do not ignore user-provided "ndots:0" option
`ndots:0` is a valid DNS option; previously, `ndots:0` was
ignored, leading to the default (`ndots:0`) also being applied;

Before this change:

    docker network create foo
    docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf
    nameserver 127.0.0.11
    options ndots:0 ndots:0

After this change:

    docker network create foo
    docker run --rm --network foo --dns-opt ndots:0 alpine cat /etc/resolv.conf
    nameserver 127.0.0.11
    options ndots:0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 00:58:36 +02:00
Sebastiaan van Stijn
6e6ac3d2ac Remove redundant and faulty assert messages
The "message" argument in assert.Equal expects a format
string; the current string was not that, resulting in an
incorrect message being printed;

    --- FAIL: TestDNSOptions (1.28s)
            Location:       service_common_test.go:92
    	Error:  	Not equal: "ndots:5" (expected)
    			        != "ndots:0" (actual)
    	Messages:	The option must be ndots:5 instead:%!(EXTRA string=ndots:0)

This patch removes the message altogether, because assert.Equal
already prints enough information to catch the error;

    --- FAIL: TestDNSOptions (1.28s)
            Location:       service_common_test.go:92
    	Error:  	Not equal: "ndots:5" (expected)
    			        != "ndots:0" (actual)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-29 00:52:16 +02:00
Flavio Crisciani
a5e7cfe3d7 Merge pull request #2138 from ctelfer/scalable-lb
Improve load balancing scalability in swarm mode
2018-06-28 15:49:55 -07:00
Chris Telfer
ac0aa6485b Adjust warnings for transient LB endpoint conds
Add debug and error logs to notify when a load balancing sandbox
is not found.  This can occur in normal operation during removal.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
0b14b45f0c Prevent race between add-binding and net-delete
Lock the network ID in the controller during an addServiceBinding to
prevent racing with network.delete().  This would cause the binding to
be silently ignored in the system.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
ea2fa20859 Add endpoint load-balancing mode
This is the heart of the scalability change for services in libnetwork.
The present routing mesh adds load-balancing rules for a network to
every container connected to the network.  This newer approach creates a
load-balancing endpoint per network per node.  For every service on a
network, libnetwork assigns the VIP of the service to the endpoint's
interface as an alias.  This endpoint must have a unique IP address in
order to route return traffic to it.  Traffic destined for a service's
VIP arrives at the load-balancing endpoint on the VIP and from there,
Linux load balances it among backend destinations while SNATing said
traffic to the endpoint's unique IP address.

The net result of this scheme is that each node in a swarm need only
have one set of load balancing state per service instead of one per
container on the node.  This scheme is very similar to how services
currently operate on Windows nodes in libnetwork.  It (as with Windows
nodes) costs the use of extra IP addresses in a network (one per node)
and an extra network hop in the stack, although, always in the stack
local to the container.

In order to prevent existing deployments from suddenly failing if they
failed to allocate sufficient address space to include per-node
load-balancing endpoint IP addresses, this patch preserves the existing
functionality and activates the new functionality on a per-network
basis depending on whether the network has a load-balancing endpoint.
Eventually, moby should always set this option when creating new
networks and should only omit it for networks created as part of a swarm
that are not marked to use endpoint load balancing.

This patch also normalizes the code to treat "load" and "balancer"
as two separate words from the perspectives of variable/function naming.
This means that the 'b' in "balancer" must be capitalized.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
85a3483b4b Refactor [add|rm]LBBackend() to use lb struct
This was passing extra information and adding confusion about the
purpose of the load balancing structure.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
78b684a24a Add ability to alias any interface in a sanbox
New load balancing code will require ability to add aliases to
load-balncer sandboxes.  So this broadens the OSL interface to allow
adding aliases to any interface, along with the facility to get the
loopback interface's name based on the OS.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
f2c6009583 Add SrcName() method to return interface name
This method returns the name of the interface from the perspective
of the host OS pre-container.  This will be required later for
finding matching a sandbox's interface name to an endpoint which
is, in turn, requied for adding an IP alias to a load balancer
endpoint.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
31d3de0994 Fix error handling in createLoadBalncerSandbox()
Error unwinding only works if the error variable is used consistently
and isn't hidden in the scope of other if statements.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
1449e88f7a Avoid default gateway collisions
Default gateways truncate the endpoint name to 12 characters.  This can
make network endpoints ambiguous especially for load-balancing sandboxes
for networks with lenghty names (such as with our prefixes).  Address
this by detecting an overflow in the sanbox name length and instead
opting to name the gateway endpoint "gateway_<id>" which should never
collide.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:18 -04:00
Chris Telfer
04bfc61497 Add option processing to network.Delete()
Change the Delete() method to take optional options and add
NetworkDeleteOptionRemoveLB as one such option.  This option allows
explicit removal of an ingress network along with its load-balancing
endpoint if there are no other endpoints in the network.  Prior to this,
the libnetwork client would have to manually search for and remove the
ingress load balancing endpoint from an ingress network.  This was, of
course, completely hacky.

This commit will require a slight modification in moby to make use of
the option when deleting the ingress network.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 12:08:12 -04:00
Chris Telfer
1abac50c8d Generate LB sandbox/endpoint names in one place
Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-28 00:46:20 -04:00
Flavio Crisciani
9d758090cf Merge pull request #2199 from selansen/new_plugin_intf
Use new plugin interfaces provided by plugin pkg
2018-06-27 17:24:20 -07:00
Chris Telfer
28ebc2617f Merge pull request #2193 from euanh/update-protobuf
Add support for regenerating protocol buffers, and refresh .pb.go files
2018-06-27 17:30:06 -04:00
Brian Goff
5525c22635 Fix unknow driver test error
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 8856c1ec9557e58917421bf1b32724262745a795)
Signed-off-by: selansen <elango.siva@docker.com>
2018-06-27 17:28:52 -04:00
Siarhei Rasiukevich
fe9a5a225d Fix net driver response loss on createEndpoint
Fix related to bug: https://github.com/docker/for-linux/issues/348
We should perform updateToStore(ep) after n.addEndpoint or do update twice,
otherwise response from network plugin will not be written to KV storage.
This results in container creation with broken network config.

Signed-off-by: Siarhei Rasiukevich <raskintech@gmail.com>
2018-06-26 13:27:47 +03:00
Flavio Crisciani
d9b5aa4c86 Merge pull request #2197 from fcrisciani/netdb-test
Add retry to cluster-peers
2018-06-25 11:54:52 -07:00
Brian Goff
f04280986e Reduce libcontainer dep
Most of the libcontainer imports was just for a single test to marshal a
simple type, meanwhile this caused all kinds of transient imports that
are not really needed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit a07a1ee9ccdf4c5a3a90eea9fd359f10b5156c84)
Signed-off-by: selansen <elango.siva@docker.com>
2018-06-23 00:15:16 -04:00
Brian Goff
791700aed3 Use new plugin interfaces provided by plugin pkg
The use of `Client()` on v2 plugins is being deprecated so that we can
be more flexible on the protocol used for plugins.

This means checking specifically if the plugin implements the
`Client() *plugins.Client` interface for V1 plugins, and for v2 plugins
building a the client manually.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 45824a226b8a220d6f189c2d25fe16f9efc83db9)
Signed-off-by: selansen <elango.siva@docker.com>
2018-06-22 23:52:02 -04:00
Brian Goff
e07681c8ca Bump docker commit
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit aae1b0e116d0c4ee0e46494864d1540fec22ced3)
Signed-off-by: selansen <elango.siva@docker.com>
2018-06-22 23:51:21 -04:00
Flavio Crisciani
62ebaeac7a Added back dockerignore
Try to reduce the docker context for the build

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-22 16:10:22 -07:00
Flavio Crisciani
28ec64d2e5 Merge pull request #2183 from euanh/update-vendoring
Update vendoring to match moby/moby
2018-06-22 08:17:39 -07:00
Euan Harris
96c7cba64c networkdb, drivers: Regenerate protocol buffers
agent.pb.go is unchanged, but the files in networkdb and drivers
are slightly different when regenerated using the current versions
of protoc and gogoproto.    This is probably because agent.pb.go
was last regenerated quite recently, in February 2018, whereas
networkdb.pb.go and overlay/overlay.pb.go were last changed in 2017,
and windows/overlay/overlay.pb.go was last changed in 2016.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-06-22 15:03:12 +01:00
Euan Harris
22a24df515 Makefile, Dockerfile: Add support for regenerating protocol buffers
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-06-22 15:03:12 +01:00
Flavio Crisciani
500d9f4515 Adjust corner case for reconnect logic
Previous logic was not accounting that each node is
in the node list so the bootstrap nodes won't retry
to reconnect because they will always find themselves
in the node map
Added test that validate the gossip island condition

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-21 18:04:55 -07:00
Chris Telfer
755ef5bf29 Merge pull request #2196 from fcrisciani/support
Add auto update to support.sh
2018-06-21 17:02:26 -04:00
Flavio Crisciani
4f3fb7ee6a Add retry to cluster-peers
Add retry field to cluster-peers probe

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-21 13:08:04 -07:00
Euan Harris
705bf07f05 vendor.conf: Update vendored components to match moby
* Update dependencies to match moby master; add new sub-dependencies
  as necessary.

* Update moby to latest

* Update gocapability

  This moves gocapability beyond the version vendored in moby;
  presumably the code which requires this particular version
  is not used in moby and is removed by vndr.   Moby will need
  to be updated as well.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-06-21 15:16:21 +01:00
Euan Harris
9b114971e5 controller: Unwrap error type returned by PluginGetter
moby/moby commit b27f70d45 wraps the ErrNotFound error returned when
a plugin cannot be found, to include a backtrace.   This changes the
type of the error, so contoller.loadDriver no longer converts it to a
libnetwork plugin.NotFoundError.  This causes a couple of tests which
inspect the return type to fail;  most code only checks whether the
error is non-nil and is not affected by the change in type.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-06-21 15:08:25 +01:00
Flavio Crisciani
5de876c7ae Add auto update to support.sh
Before running the support script
try to fetch the latest version

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-20 15:29:45 -07:00
Flavio Crisciani
6716626d32 Merge pull request #2172 from thaJeztah/update_miekd_dns
Update miekg/dns to v1.0.7
2018-06-20 14:31:49 -07:00
Flavio Crisciani
9dbf55097a Create support as a container
Containerize support.sh

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-20 14:05:14 -07:00
Flavio Crisciani
8f1fca3e66 Multistage for build
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-19 21:51:11 -07:00
Flavio Crisciani
c548093db6 Merge pull request #2191 from euanh/bump-go-version
Dockerfile.build: Bump Go to 1.10.2
2018-06-19 09:24:11 -07:00
Flavio Crisciani
8dd7572a4c Merge pull request #2168 from selansen/circle2.0
Migration from CircleCI1.0 to CircleCI2.0
2018-06-19 09:23:34 -07:00
Euan Harris
24bdb26483 Dockerfile.build: Bump Go to 1.10.2
This brings libnetwork up to date with moby/moby.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-06-19 14:07:58 +01:00
Abhinandan Prativadi
f5fa40f9aa Fixing the unit test for overlapping subnet
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-06-18 12:31:48 -07:00
Flavio Crisciani
59a2ef7843 Merge pull request #2128 from fcrisciani/go-sockaddr-vndr
Vendor go-sockaddr
2018-06-18 11:37:12 -07:00
Flavio Crisciani
828a6d788e Merge pull request #2177 from ctelfer/subnet-cursor
Avoid reusing subnets when allocating from pools
2018-06-18 11:23:11 -07:00
Flavio Crisciani
891fb82213 Merge pull request #2148 from abhi/ipam-check
Adding a check for subnet pool overlap
2018-06-18 11:19:41 -07:00
Flavio Crisciani
c7300fec17 Merge pull request #2160 from euanh/portbinding-ipv6
types: Handle IPv6 literals correctly in port bindings
2018-06-18 09:19:48 -07:00
Flavio Crisciani
48196df4a2 Further makefile cleanup
- cleaned the make check
- local build do not require context

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-16 11:03:11 -07:00
selansen
fbf02c3794 Migration from CircleCI1.0 to CircleCI2.0
This commit will allow us to use newer version of CircleCI.

Signed-off-by: selansen <elango.siva@docker.com>
2018-06-16 11:03:11 -07:00
Trapier Marshall
bef873c9df support.sh: add host links
also made the heading for host iptables state clearer

Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
2018-06-13 16:27:54 -04:00
Chris Telfer
e31e906e4e Add pool reuse test to unit tests
Add a test to confirm that the pool allocator will iterate through all
the pools even if some earlier ones were freed before coming back to
previously allocated pools.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-08 19:26:10 -04:00
Chris Telfer
cc8b2cac28 Allocate subnets in order rather than restarting
This commit prevents subnets from being reused at least initially,
instead favoring to cycle through them as we do with addresses within a
subnet.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-08 19:26:04 -04:00
Flavio Crisciani
5f23795eef Merge pull request #2180 from ctelfer/fix-overlay-deadlock-regression
Fix spurious deadlock in overlay driver
2018-06-08 13:38:34 -07:00
Chris Telfer
f0c86fb56e Fix deadlock introduced in b64997ea
Commit b64997ea prevented data corruption due to simultaneous
driver.CreateNetwork()/driver.DeleteNetwork() by holding the network
lock through the read/modify part of the operation.  However, part of
the DeleteNetwork operation entails sending a message to the peerDB to
tell that goroutine to flush entries on deletion.  This can lead to a
deadlock where:
  * driver.DeleteNetwork() starts and acquires driver.Lock()
  * peerDB receives some other request (e.g. EventNotify) and blocks
    on driver.Lock()
  * driver.DeleteNetwork() attempts a peerDB flush and blocks waiting
    on the synchronous peerDB operation channel

This patch fixes the issue by deferring the peerDB flush operation until
after DeleteNetwork() unlocks driver.Lock().   Commit b64997ea only
modified CreateNetwork() and DeleteNetwork() and the critical section
that driver.Lock() protects in CreateNetwork() does not perform any
peerDB notifications or other locks of driver data structures.  So this
solution should be a complete fix for any regressions introduced in
b64997ea.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-06-08 14:17:51 -04:00
Flavio Crisciani
3d2b2f1c7e Possible race on ingress programming
Make sure that iptables operations on ingress
are serialized.
Before 2 racing routines trying to create the ingress chain
were allowed and one was failing reporting the chain as
already existing.
The lock guarantees that this condition does not happen anymore

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-06-07 13:02:04 -07:00
Sebastiaan van Stijn
01e6a24545 Update miekg/dns to v1.0.7
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-06-01 16:32:04 +02:00
Chris Telfer
c4d507b566 Remove non-service cluster info on sbLeave
The system should remove cluster service info including networkDB
entries and DNS entries for container endpoints that are not part of a
service as well as those that are part of a service.  This used to be
the normal sequence of operations but it moved to
sandbox.DisableService() in an effort to more gracefully handle endpoint
removal from a service (which proved insufficient).  Unfortunately
subsequent changes also removed the newly-mandetory call to
sandbox.DisableService() preventing proper cleanup for non-service
container endpoints.

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-05-31 14:21:55 -04:00
Yang Li
b0b5e14b77 test: update tests to use sub-benchmarks
Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Some tests are not using this feature.

Signed-off-by: Yang Li <idealhack@gmail.com>
2018-05-31 11:34:15 +08:00
Chris Telfer
147912afad Merge pull request #2132 from cziebuhr/2093-iface_order2
Improve interface order
2018-05-30 12:26:38 -04:00
Euan Harris
e3c212c224 types: Handle IPv6 literals correctly in port bindings
Use net.splitHostPort() instead of our own logic in func (p *PortBinding)
FromString(s string) error.   This means that IPv6 literals, including
IPv4 in IPv6 literals, can now be parsed from the string form of
PortBindings.   Zoned addresses do not work - net.splitHostPort() parses
them but net.ParseIP() cannot and returns an error.   This is ok because
we do not have a slot to store the zone name in PortBinding anyway.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-30 16:12:19 +01:00
Flavio Crisciani
328948d35a Fix type in error message
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-05-29 08:56:49 -07:00
Flavio Crisciani
a1c61ab794 Merge pull request #2161 from fcrisciani/networkdb-test-image
Enable network-db test image creation
2018-05-29 08:47:28 -07:00
Flavio Crisciani
87d6ce3d5a Merge pull request #2164 from idealhack/typo
typo: fix misspells in code and comments
2018-05-29 08:45:48 -07:00
Flavio Crisciani
1784a46e64 Enable network-db test image creation
Updated makefile
Moved binaries in the bin/ directory

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-05-29 08:03:32 -07:00
Yang Li
f6d9d22e6f test: fix ineffectual assignments
Signed-off-by: Yang Li <idealhack@gmail.com>
2018-05-29 18:08:32 +08:00
Yang Li
f9f3b1bdeb typo: fix misspells in code and comments
Signed-off-by: Yang Li <idealhack@gmail.com>
2018-05-29 17:08:41 +08:00
Christoph Ziebuhr
67dbb04852 Improve interface order
Signed-off-by: Christoph Ziebuhr <chris@codefrickler.de>
2018-05-25 17:40:32 +02:00
Euan Harris
e7fcca2f9f Makefile: build image is a prerequisite of the shell target
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-25 15:43:08 +01:00
Euan Harris
35f505210b types/types: Correct docstring typo for (PortBinding)FromString
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-24 14:35:36 +01:00
Euan Harris
f6ddf88cec types/types_test: Rename test to match function
The function tested by TestUtilGetHostPortionIP is called GetHostPartIP.
Rename the test to match the function being tested.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-24 10:03:25 +01:00
Euan Harris
ebf0054912 ipam/allocator: Fix typos in error message
Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-23 11:03:55 +01:00
Madhu Venugopal
fa29610f7e Merge pull request #2153 from fcrisciani/maintainers
Maintainers update
2018-05-21 18:48:34 -04:00
Flavio Crisciani
5f0e69d002 Merge pull request #2152 from euanh/ipam-pool-double-alloc-test
ipam/allocator_test: Test pool double-release behavior
2018-05-21 10:30:27 -07:00
Flavio Crisciani
48eba3c2c9 Maintainers update
- Add Abhi and Chris
- Remove inactive maintainers

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-05-18 09:36:32 -07:00
Euan Harris
35a81f8173 ipam/allocator_test: Test pool double-release behavior
Releasing a pool which has already been released should fail; this
change increases coverage by a fraction by exercising this path.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-18 17:32:36 +01:00
Euan Harris
b4c09ceae2 Makefile: Add shell target
This makes it easy to drop into the build container, for instance to
run tests or other Go tools over a subset of the code.

Signed-off-by: Euan Harris <euan.harris@docker.com>
2018-05-18 16:44:00 +01:00
Abhinandan Prativadi
2f2811dd14 Adding logs for ipam state
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
2018-05-14 15:44:49 -07:00