220 Commits

Author SHA1 Message Date
Madhu Venugopal e8f3c15beb Merge pull request #473 from brahmaroutu/fix_ibm_power
Adding ppc64le build tag to compile on IBM Power
2015-08-30 12:43:06 -07:00
Alessandro Boch 13738d592e Fixes ip allocation for multi bridge networks
- Do not discard errors on ip allocation for gw and bridge
- Release addresses on network delete
- Add some context on top of ipallocator returned error
- Create ip allocator instance at driver creation, not at package init,
  otherwise this affects bridge test code where ip db is carried over
  test functions

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-27 20:39:30 -07:00
Alessandro Boch 9a47be244a Introduce Sandbox entity
- Maps 1 to 1 with container's networking stack
- It holds container's specific nw options which
  before were incorrectly owned by Endpoint.
- Sandbox creation no longer coupled with Endpoint Join,
  sandbox and endpoint have now separate lifecycle.
- LeaveAll naturally replaced by Sandbox.Delete
- some pkg and file renaming in order to have clear
  mapping between structure name and entity ("sandbox")
- Revisited hosts and resolv.conf handling
- Removed from JoinInfo interface capability of setting hosts and resolv.conf paths
- Changed etchosts.Build() to first write the search domains and then the nameservers

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-27 11:19:02 -07:00
Srini Brahmaroutu cb678f55ee Adding ppc64le build tag to compile on IBM Power
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-08-27 04:18:34 +00:00
Santhosh Manohar 46a4bde982 Overlay driver should assign interface mac based on the IP
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2015-08-14 23:59:02 -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
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
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
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 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
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
Madhu Venugopal 9f903375f8 Merge pull request #399 from mdavranche/brnetfilter
Fix module loading return.
2015-08-04 08:41:13 -07: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
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
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
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 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
Shijiang Wei 21e6f10be6 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 dbe6172d8c 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 fd896b98ce 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 bf4ea43b71 Merge pull request #412 from mrjana/bugs
Use sysfs to set hairpin mode
2015-07-24 12:03:53 -07:00
Jana Radhakrishnan 9740746cf5 Merge pull request #409 from alecbenson/iccfix
Fix ICC on Fedora systems with Firewalld
2015-07-24 10:46:03 -07:00
Jana Radhakrishnan ef0378b1f3 Merge pull request #288 from aboch/ag
Pass a canonical subnet to ipallocator
2015-07-24 10:45:20 -07:00
Jana Radhakrishnan 22e60f160b 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 7110f5ae6c 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
Jana Radhakrishnan c7b0931862 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
Alexander Morozov fb6dd9766e Remove dependency on libcontainer
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-16 13:26:26 -07:00
Erik Hollensbe 100f13fff5 Expose the remote driver API structs publicly. 2015-07-16 06:11:50 +00:00
Chun Chen 112ff16d32 Fix duplicate POSTROUTING MASQUERADE rules
Signed-off-by: Chun Chen <ramichen@tencent.com>
2015-07-13 16:38:04 +08:00
Madhu Venugopal bc3bf488c3 Fixed a bug in DeleteEndpoint to properly release v6 ip
When fixed-cidrv6 is used, the allocation and release must happen from
the appropriate network. Allocation is done properly in createendpoint,
but the DeleteEndpoint wasnt taking care of this case.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-07-09 20:46:36 -07:00
Alec Benson ec88bd0a72 Refactor of docker PR #11405
Signed-off-by: Alec Benson <albenson@redhat.com>
2015-07-08 10:15:08 -04:00
Dave Tucker f5df0c6bbd Use IANA assigned VXLAN port
Fixes #358

Signed-off-by: Dave Tucker <dt@docker.com>
2015-07-03 03:43:02 +01:00
Jana Radhakrishnan 69f7012abc Adjust overlay driver for netlink api change
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 10:39:43 -07:00
Jana Radhakrishnan ef34c93d96 Honor driver side resolv.conf file
For the moment in 1.7.1 since we provide a resolv.conf set api
to the driver honor that so that for host driver we can use the
the host's /etc/resolv.conf file as is rather than putting the
contents through a filtering logic.

It should be noted that the driver side capability to set the
resolv.conf file is most likely going to go away in the future
but this should be fine for 1.7.1

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 10:39:06 -07:00
Jana Radhakrishnan d7cfd9b2f1 Manually bring up the host side veth interface
In preparation for the new update of vishvananda/netlink package
we need to bringup the host veth interface manually.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 09:32:03 -07:00
Jana Radhakrishnan 3527ebe475 Fix networking issues in RHEL/Centos 6.6
Some parts of the bridge driver code needs to use a different kernel
api or use the already existing apis in slightly different ways to
make the bridge driver work in RHEL/Centos 6.6. This PR provides
those fixes.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 09:31:13 -07:00
Jana Radhakrishnan ccc42943dd Use ioctls to create bridge
The netlink way of creating bridge has problems in older
kernels like the one used on RHEL 6 (which is a supported
one). So trying to use ioctl method to create bridge
so that it works on any version.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-07-02 09:27:53 -07:00
Madhu Venugopal 64d1b728bb Merge pull request #278 from LK4D4/firewalld_support
Resurrect firewalld support
2015-06-26 13:12:19 -07:00
aboch 7d501b2b73 Merge pull request #304 from wulonghui/wulonghui-patch-1
Update modprobe bridge output
2015-06-25 16:51:30 -07:00
Spike Curtis e2a63dff5a Datastore handles creating objects atomically.
In that commit, AtomicPutCreate takes previous = nil to Atomically create keys
that don't exist.  We need a create operation that is atomic to prevent races
between multiple libnetworks creating the same object.

Previously, we just created new KVs with an index of 0 and wrote them to the
datastore.  Consul accepts this behaviour and interprets index of 0 as
non-existing, but other data backends do no.

 - Add Exists() to the KV interface.  SetIndex() should also modify a KV so
   that it exists.
 - Call SetIndex() from within the GetObject() method on DataStore interface.
   - This ensures objects have the updated values for exists and index.
 - Add SetValue() to the KV interface.  This allows implementers to define
   their own method to marshall and unmarshall (as bitseq and allocator have).
 - Update existing users of the DataStore (endpoint, network, bitseq,
   allocator, ov_network) to new interfaces.
 - Fix UTs.
2015-06-25 10:53:48 -07:00
wulonghui 7df8d3eb4c Update error return in bridge driver's getNetwork 2015-06-25 19:33:46 +08:00