Commit Graph

479 Commits

Author SHA1 Message Date
Zhang Wei
d715041cd0 Fix typo
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-08-15 15:48:14 +08:00
Jana Radhakrishnan
9169198dc6 Update vishvananda/netlink
Update netlink package to fix some critical
netlink issues.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-08-14 18:01:15 -07:00
Jana Radhakrishnan
61f3a2e253 Fix racy joinSandbox behavior
The current lazy network sandbox initialization code has a race
in that if multiple go routines race to join the network the second
and subsequent go routines might try to use the sandbox before it is
fully initialized. Fix this by blocking the go routines in once.Do
calls and also take of care of rolling back properly in case of
error.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-08-13 14:55:16 -07:00
Madhu Venugopal
6c988dad16 Merge pull request #285 from lindenlab/custom-host-port-ranges
Adding libnetwork support to publish on custom host port ranges.
2015-08-12 16:01:44 -07:00
aboch
d0b979069f Merge pull request #447 from sanimej/libn-exp-local
Pass the vxlan port in network endian order
2015-08-07 17:36:33 -07:00
Don Kjer
8d73de9722 Adding libnetwork support to publish on custom host port ranges.
See https://github.com/docker/docker/pull/12927 for docker portion.

Signed-off-by: Don Kjer <don.kjer@gmail.com>
2015-08-08 00:23:03 +00:00
Madhu Venugopal
50ac01f7f4 Updated Godeps to the latest vishvanandha/netlink
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-08-07 16:40:32 -07:00
Santhosh Ram Manohar
960639fbb9 Pass the vxlan port in network endian order
Signed-off-by: Santhosh Ram Manohar <santhosh@docker.com>
2015-08-07 14:58:41 -07:00
Madhu Venugopal
e39c9aff7c Merge pull request #444 from aboch/dl
Fix in bridge delete endpoint
2015-08-07 05:43:31 -07:00
Alessandro Boch
1bf751ef93 Fix in bridge delete endpoint
- In DeleteEndpoint(), veth removal is a best effort,
  as it could have alreayd been removed by sandbox destroy.
  Therefore if veth is not found, cleanup defer function
  should not run.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-06 17:04:38 -07:00
Alessandro Boch
021d71de29 Fix bug "...has already joined the endpoint"
- In case of sandboxAdd() failure, drive.Leave() call
  in first executed defer reset err to nil. Secondly
  executed defer in charge of resetting ep.container to nil
  will not get executed.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-05 17:13:46 -07:00
Madhu Venugopal
f7d4913ab9 Merge pull request #283 from mbanikazemi/iptables_setup
Separates the driver-specific and network-specific iptable operations
2015-08-05 09:41:54 -07:00
Tomas Kral
5a259d55f0 modify /proc/sys only if needed
fixes #405

Signed-off-by: Tomas Kral <tomas.kral@gmail.com>
2015-08-05 13:46:28 +02:00
Mohammad Banikazemi
12df37fdd0 Seperates the driver-specific and network-specific iptable operations
for the bridge driver.

Moves two config options, namely EnableIPTables and EnableUserlandProxy
from networks to the driver.

Closes #242
Signed-off-by: Mohammad Banikazemi <MBanikazemi@gmail.com>
2015-08-04 17:26:41 -04:00
Madhu Venugopal
4cebc617d1 Merge pull request #434 from runcom/remove-unused-config-check
Remove unused config check
2015-08-04 12:51:27 -07:00
aboch
827b2c667a Merge pull request #422 from kolyshkin/mkdirall
Simplify and fix os.MkdirAll() usage
2015-08-04 09:29:53 -07:00
Madhu Venugopal
82043dc94a Merge pull request #436 from wulonghui/wulonghui-patch-4
Fix example package error
2015-08-04 08:45:09 -07:00
Madhu Venugopal
80ed7379af Merge pull request #399 from mdavranche/brnetfilter
Fix module loading return.
2015-08-04 08:41:13 -07:00
wulonghui
7a5224afe4 Fix example package error 2015-08-04 11:14:01 +08:00
Madhu Venugopal
fd8067f513 Merge pull request #426 from aboch/mc
Reorganize MAC generation functions
2015-08-03 16:38:08 -07:00
Madhu Venugopal
9863e2c286 Merge pull request #433 from aboch/24
Bug in bridge network mask
2015-08-03 16:18:27 -07:00
Alessandro Boch
e8771c868e Bug in bridge network mask
- that was causing all networks to be /24

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-03 16:11:06 -07:00
Antonio Murdaca
c38d2d4601 Remove unused config check
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-08-04 01:04:11 +02:00
Madhu Venugopal
21973c0ff3 Merge pull request #375 from chenchun/dup_masq_rule
Fix duplicate POSTROUTING MASQUERADE rules
2015-08-03 15:42:12 -07:00
Madhu Venugopal
0b458d70ce Fixing Vagrant to use ubuntu 15.04 to get Experimental docker working again
14.10 reached EOL recently and hence experimental builds are not built for
that distro any more. Upgrading it to 15.04 means handling the systemd
specific docker daemon configs required for multi-host networking.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-07-31 18:08:27 -07:00
Alessandro Boch
3da75632f7 Reorganize MAC generation functions
- We have more than one function doing the same thing

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-30 11:06:16 -07:00
Jana Radhakrishnan
c3a0877161 Merge pull request #424 from mavenugo/nlioctl
Prefer Netlink over ioctl
2015-07-30 10:20:07 -07:00
Madhu Venugopal
65ac045a33 Merge pull request #423 from mrjana/bugs
Fix data race in controller sandboxes
2015-07-30 09:42:28 -07:00
Madhu Venugopal
6901ea51dc Prefer Netlink calls over ioctl
As seen in https://github.com/docker/docker/issues/14738 there is
general instability in the later kernels under race conditions when ioctl
calls are used in parallel with netlink calls for various operations.
(We are yet to narrow down to the exact root-cause on the kernel).

For those older kernels which doesnt support some of the netlink APIs,
we can fallback to using ioctl calls. Hence bringing back the original
code that used netlink (https://github.com/docker/libnetwork/pull/349).

Also, there was an existing bug in bridge creation using netlink which
was setting bridge mac during bridge creation. That operation is not
supported in the netlink library (and doesnt throw an error either).
Included a fix for that condition by setting the bridge mac after
creating the bridge.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-07-30 09:10:22 -07:00
Madhu Venugopal
94791877ee Merge pull request #421 from aboch/kn
Incorrect kernel version check in bridge
2015-07-30 08:15:02 -07:00
Alessandro Boch
c266c843a7 Incorrect kernel version check in bridge
- Kernel version check logic was wrong

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-30 06:51:43 -07:00
mikael.davranche
0c2293e0a0 Fix bridge and br_netfilter modules loading.
Signed-off-by: mikael.davranche <mikael.davranche@corp.ovh.com>
2015-07-30 09:34:09 +02:00
Jana Radhakrishnan
092437ad0e Fix data race in controller sandboxes
The controller sandboxes hashmap is not being protected by a lock
while deleting it in `LeaveAll` call. This may result in a race
whereby any other read access that happens with the lock held is
also vulnerable to return random sandbox data which could result
in totally unpredictable behavior.

Also as part of the fix check if `s.endpoints` is empty and log an
error in `rmEndpoint` so that we don't bring down the process
for this unexpected error.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-29 23:57:50 -07:00
Kir Kolyshkin
140616a7d6 Simplify and fix os.MkdirAll() usage
TL;DR: check for IsExist(err) after a failed MkdirAll() is both
redundant and wrong -- so two reasons to remove it.

Quoting MkdirAll documentation:

> MkdirAll creates a directory named path, along with any necessary
> parents, and returns nil, or else returns an error. If path
> is already a directory, MkdirAll does nothing and returns nil.

This means two things:

1. If a directory to be created already exists, no error is
returned.

2. If the error returned is IsExist (EEXIST), it means there exists
a non-directory with the same name as MkdirAll need to use for
directory. Example: we want to MkdirAll("a/b"), but file "a"
(or "a/b") already exists, so MkdirAll fails.

The above is a theory, based on quoted documentation and my UNIX
knowledge.
3. In practice, though, current MkdirAll implementation [1] returns
ENOTDIR in most of cases described in #2, with the exception when
there is a race between MkdirAll and someone else creating the
last component of MkdirAll argument as a file. In this very case
MkdirAll() will indeed return EEXIST.

Because of #1, IsExist check after MkdirAll is not needed.

Because of #2 and #3, ignoring IsExist error is just plain wrong,
as directory we require is not created. It's cleaner to report
the error now.

[1] https://github.com/golang/go/blob/f9ed2f75/src/os/path.go

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2015-07-29 18:09:42 -07:00
Jana Radhakrishnan
964d926aa7 Merge pull request #300 from aboch/qr
Pass proper regex to mux for query fields
2015-07-29 09:47:17 -07:00
Jana Radhakrishnan
214a1af907 Merge pull request #249 from erikh/expose-api
Expose the remote driver API structs publicly.
2015-07-29 08:47:50 -07:00
Madhu Venugopal
5758009f7c Merge pull request #419 from mountkin/avoid-iface-leak-on-error
make sure the interfaces is cleared on error
2015-07-29 08:20:28 -07:00
Shijiang Wei
d6685f61a7 make sure the interfaces is cleared on error
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
2015-07-29 20:15:02 +08:00
Alessandro Boch
6461057521 Misc fixes to ipallocator & bridge driver about FixedCIDR
- NetworkRange() function on which ipallocatore relies
  to compute the subnet limits has a bug in computing the upper limit IP
- in case container subnet is specified (fixedCIDR), bridge driver to
  reserve bridge and gateway addresses only if they belong to the container
  subnet
- Make ipallocator more robust in using converting the passed network
  to a canonical one before using it as a key in its public APIs

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-27 18:12:33 -07:00
Alessandro Boch
88c2c05ce9 Misc fixes to ip allocation in bridge driver
Two changes were missing:
- On allocation of bridge ip was not passing canonical subnet
- Canonical subnet has to be passed on ip release
  as well, otherwise ipallocator will attempt
  ip release from a non registered nw

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-24 16:59:27 -07:00
aboch
dbe595343e Merge pull request #412 from mrjana/bugs
Use sysfs to set hairpin mode
2015-07-24 12:03:53 -07:00
Jana Radhakrishnan
2d8377f615 Merge pull request #409 from alecbenson/iccfix
Fix ICC on Fedora systems with Firewalld
2015-07-24 10:46:03 -07:00
Jana Radhakrishnan
dc3bb60faa Merge pull request #288 from aboch/ag
Pass a canonical subnet to ipallocator
2015-07-24 10:45:20 -07:00
Jana Radhakrishnan
2dd9a6fa75 Use sysfs to set hairpin mode
Set the hairpin mode using the sysfs interface which
looks like it is working all the way to the oldest
of RHEL6.6 kernels.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-24 10:26:08 -07:00
Alec Benson
21b0927720 Fix ICC on Firewalld enabled fedora systems, add in missing firewalld functionality to re-apply configuration when reloaded
Signed-off-by: Alec Benson <albenson@redhat.com>
2015-07-24 13:20:48 -04:00
Andrei Ushakov
b62013c24c deadlock fix in RemoveStaticRoute 2015-07-24 01:32:35 -07:00
Kunal Kushwaha
83b6a338a4 Reduced the two spaces for network help, required to pass tests at docker build
Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2015-07-23 11:46:57 +09:00
Madhu Venugopal
413224ea84 Merge pull request #403 from mrjana/overlay
Sometimes fdb points to wrong vtep
2015-07-23 05:09:02 +05:30
Alexey Guskov
94ca1f5bba make libnetwork compile on freebsd (again)
Signed-off-by: Alexey Guskov <lexag@mail.ru>
2015-07-21 19:41:01 +03:00
Jana Radhakrishnan
524b3dca97 Sometimes fdb points to wrong vtep
When you start a container after some other container has already
been started in the same network, the current container will have
an fdb which points to a wrong vtep to reach the already started
container. This makes the network connectivity to not work. The root
cause of the issue is because of golang does variable capture by
reference in closures and so we cannot use the return values from
range iterators directly. It needs to be copied to a locally scoped
variable and then use that copy as a capture variable in the closure.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-20 18:01:40 -07:00