Commit Graph

629 Commits

Author SHA1 Message Date
Alessandro Boch 4e48ff3aab Fix preferred ip allocation in ipam
- also provided a new utility to compute the
  host part ip address which is resilient to
  input passed in different representations.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch fa75dc24c4 idm and ipam to use bitseq atomic APIs
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch ffd7952f64 bitseq to provide atomic functions
- Also add validation for passed ordinal

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch 05efb232d0 bitseq to only handle and return unsigned types
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch a5fb461351 Control exported types in bitseq
- bitseq users only need to know Handle type

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch e295febf03 network byte order to bitseq serializer
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Madhu Venugopal 7204731c4d Merge pull request #457 from WeiZhang555/typo
Fix typo
2015-08-15 07:52:20 -07:00
Zhang Wei 89b183f9a1 Fix typo
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-08-15 15:48:14 +08:00
aboch 0a5aca96e1 Merge pull request #456 from mrjana/bugs
Update vishvananda/netlink
2015-08-14 18:08:49 -07:00
Jana Radhakrishnan 15fcb1ea06 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
Madhu Venugopal 22dc04d060 Merge pull request #454 from mrjana/overlay
Fix racy joinSandbox behavior
2015-08-13 15:26:22 -07:00
Jana Radhakrishnan af4e676550 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 1fde5d5dd0 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 b642de8d76 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 56921c850e 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
aboch aff4face68 Merge pull request #448 from mavenugo/nl_godep
Updated Godeps to the latest vishvanandha/netlink
2015-08-07 16:58:02 -07:00
Madhu Venugopal 9754be0f4a 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 edc929bb05 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 7659c25f08 Merge pull request #444 from aboch/dl
Fix in bridge delete endpoint
2015-08-07 05:43:31 -07:00
Alessandro Boch 0eb9387480 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
Madhu Venugopal 8280c188e2 Merge pull request #440 from aboch/dfe
Fix bug "...has already joined the endpoint"
2015-08-05 17:42:58 -07:00
Alessandro Boch 50d35c0a8a 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 54a2ee8e58 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
aboch b60effc798 Merge pull request #407 from kadel/405-check-before-set-ipv4forward
write to /proc/sys/net/ipv4/ip_forward only if is not already enabled
2015-08-05 08:28:14 -07:00
Tomas Kral d45f364aeb 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 9c6ab12376 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 84d8c77b20 Merge pull request #434 from runcom/remove-unused-config-check
Remove unused config check
2015-08-04 12:51:27 -07:00
aboch bdcd5a8b54 Merge pull request #422 from kolyshkin/mkdirall
Simplify and fix os.MkdirAll() usage
2015-08-04 09:29:53 -07:00
Madhu Venugopal 01c5f45ca2 Merge pull request #436 from wulonghui/wulonghui-patch-4
Fix example package error
2015-08-04 08:45:09 -07:00
Madhu Venugopal 9f903375f8 Merge pull request #399 from mdavranche/brnetfilter
Fix module loading return.
2015-08-04 08:41:13 -07:00
wulonghui 677f9b7d7e Fix example package error 2015-08-04 11:14:01 +08:00
Madhu Venugopal 7f2198a533 Merge pull request #426 from aboch/mc
Reorganize MAC generation functions
2015-08-03 16:38:08 -07:00
Madhu Venugopal 476ab0dbea Merge pull request #433 from aboch/24
Bug in bridge network mask
2015-08-03 16:18:27 -07:00
Alessandro Boch daf7111150 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 f657962ddb Remove unused config check
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-08-04 01:04:11 +02:00
Madhu Venugopal 89ab8f7876 Merge pull request #375 from chenchun/dup_masq_rule
Fix duplicate POSTROUTING MASQUERADE rules
2015-08-03 15:42:12 -07:00
aboch 33d8e828aa Merge pull request #431 from mavenugo/vagrant
Fixing Vagrant to use ubuntu 15.04 to pull Experimental docker version
2015-08-01 10:33:26 -07:00
Madhu Venugopal b4cc3c4c1c 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 20e2079cfb 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 69ca590d5d Merge pull request #424 from mavenugo/nlioctl
Prefer Netlink over ioctl
2015-07-30 10:20:07 -07:00
Madhu Venugopal 783efcd822 Merge pull request #423 from mrjana/bugs
Fix data race in controller sandboxes
2015-07-30 09:42:28 -07:00
Madhu Venugopal 79b3e7761d 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 aa9c60c86b Merge pull request #421 from aboch/kn
Incorrect kernel version check in bridge
2015-07-30 08:15:02 -07:00
Alessandro Boch 7f1bd47fac 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 2626408796 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 81edaa64a7 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 7bfcba84c0 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 cd3ea5bd2c 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 4d6e9ae0da 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 979a0eb2e4 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