Commit Graph

66 Commits

Author SHA1 Message Date
d0893cb64b Tidy driver.go/LinkContainers
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 38a595aec561b8a7b4325b6c1c4efd1b0b8e89c0
Component: engine
2014-12-21 13:42:02 +10:00
4b105a7583 Create tests for pkg/iptables
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 0da92633b4161ed1f8babe5ec4a9fe98257d34b5
Component: engine
2014-12-21 12:57:32 +10:00
ae55b92633 Create DOCKER forward chain on driver init
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: 2865373894f1532fa725481e8f04db4a5d7a0aa8
Component: engine
2014-12-21 12:57:32 +10:00
c720d69487 Move per-container forward rules to DOCKER chain
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
Upstream-commit: cc89b30d35edc02fc598a0b26fe7a1ed002238e4
Component: engine
2014-12-21 12:57:32 +10:00
9254581bd3 Try other port on any error from Map
Sometimes other programs can bind on ports from our range, so we just
skip this ports on allocation.

Fixes #9293
Probably fixes #8714

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a00a1a1fca020d21cb677439160e018bda5c3835
Component: engine
2014-12-01 16:26:30 -08:00
95c96f42c9 Merge pull request #9149 from swagiaal/fix-configureBridge-comment
Remove reference to 'ifaceName' from configureBridge comment.
Upstream-commit: a43ee077dca75d0e8f198275db17eac341b0ca8c
Component: engine
2014-11-21 16:37:28 -05:00
c878d4a442 Apply same typed iptables errors to network driver.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Upstream-commit: f6c7194539720473aae814d3d1445eab2a78d568
Component: engine
2014-11-20 18:07:15 -08:00
a47630e4a6 Increase timeout for userland proxy starting
Fixes #8883

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 72c55e82156843c73ab1405b565e63d947b66c10
Component: engine
2014-11-20 09:02:42 -08:00
89f15328f3 Merge pull request #8699 from shuai-z/fix-portalloc
Fix corner cases in ipallocator and portallocator
Upstream-commit: 34cb92e2d49e2c141a67cd5df73a54c1655b2842
Component: engine
2014-11-16 22:10:40 -08:00
9224549fdb Remove reference to 'ifaceName' from configureBridge comment.
The argument ifaceName was removed in a much earlier commit.

Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
Upstream-commit: a01f1e707eb682ec60d489a4171d2c82de79ee57
Component: engine
2014-11-13 10:19:56 -05:00
87ba3d709c Merge pull request #8877 from erikh/proxy_error_check
proxy: Fix a potential panic handling error states.
Upstream-commit: fa59fe997c83e2a6968f8c03c64352acd71c26da
Component: engine
2014-11-04 11:40:02 -05:00
47d12f79de fixed the way of iterating over the range of map.
Fixed the following errors:
1. Request(0) causes a dead loop when the map is full and map.last == BEGIN.
2. When map.last is the only available port (or ip), Request(0) returns ErrAllPortsAllocated (or ErrNoAvailableIPs). Exception is when map.last == BEGIN.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 4c978322979f00408c72b50931a8cdea2d5cdefc
Component: engine
2014-11-04 13:46:53 +08:00
b972337ce2 adding support for port ranges on --expose
Closes #1834

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: fd774a818c7d8942922b4f74eabd2a4e14094e1a
Component: engine
2014-10-31 23:06:30 +00:00
7c71344f59 proxy: Fix a potential panic handling error states.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: ad5b307d0fb00ff0a63b3f97e529fa67bfce50b3
Component: engine
2014-10-31 04:20:26 +00:00
3dbfc4607d pkg/reexec: move reexec code to a new package
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: acd64278f13ef0ee565f4819951393b9c3fe89eb
Component: engine
2014-10-30 14:48:30 +02:00
28bd6d74bf Fix compilation issue bringed by #8319
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 4da25724248d988771c2a546aa065505ceb24038
Component: engine
2014-10-29 09:31:35 -07:00
0a96e49cc3 Merge pull request #8319 from MalteJ/ipv6-ipallocator
Implementing IPv6 functionality for ipallocator
Upstream-commit: fd19e473fc81c8b58d82b1b77cd992c43faa64a8
Component: engine
2014-10-29 09:20:52 -07:00
bad39206ea Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: ee7dd44c017458c8fe0be8e09569b1238366dca3
Component: engine
2014-10-24 15:11:48 -07:00
2d56e3cbc6 Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 7c62cee51edc91634046b4faa6c6f1841cd53ec1
Component: engine
2014-10-24 15:03:06 -07:00
ecded68887 Merge pull request #8671 from shuai-z/master
Port number 49153(BeginPortRange) would be returned twice, causing dupli...
Upstream-commit: 0e6242122d9780709c057fc32e9970529c2e09fb
Component: engine
2014-10-23 17:37:38 -07:00
deaa163ba3 Gracefully handle network bridge without IP association at startup
Addresses #8444

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 1262b5f605e8f897acb2b9ee261edbab7f1f8947
Component: engine
2014-10-23 16:19:12 -04:00
b91a2b389f added test, gofmtd
Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 2c2edabca5471fa969358cb98619f277d585e76c
Component: engine
2014-10-23 11:35:12 +08:00
79574eea31 Port number 49153(BeginPortRange) would be returned twice, causing duplication and potential errors.
If we first request port 49153 (BeginPortRange) explicitly, and later some time request the next free port (of same ip/proto) by calling RequestPort() with port number 0, we will again get 49153 returned, even if it's currently in use. Because findPort() blindly retured BeginPortRange the first run, without checking if it has already been taken.

Signed-off-by: shuai-z <zs.broccoli@gmail.com>
Upstream-commit: 9451cf39eff037eccb04319c1e601d08495cab3c
Component: engine
2014-10-23 10:49:33 +08:00
3b41fdc9e8 pass extra file to child process as status handler
When stdout/stderr is closed prematurely, the proxy's writes to stdout/stderr
(i.e. `log.Errorf/log.Printf`) will returns with EPIPE error, and go runtime
will terminate the proxy when stdout/stderr writes trigger 10 EPIPE errors.

instead of using stdout/stderr as the status handler, we pass an extra file to
the child process and write `0\n` or `1\nerror message` to it and close it
after. This allow the child process to handle stdout/stderr as normal.

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
Upstream-commit: 3b9d88210e763bebdfd7badb6ed3fd507d0f6513
Component: engine
2014-10-08 12:53:43 -04:00
4418404026 Support for consistent MAC address.
Right now, MAC addresses are randomly generated by the kernel when
creating the veth interfaces.

This causes different issues related to ARP, such as #4581, #5737 and #8269.

This change adds support for consistent MAC addresses, guaranteeing that
an IP address will always end up with the same MAC address, no matter
what.

Since IP addresses are already guaranteed to be unique by the
IPAllocator, MAC addresses will inherit this property as well for free.

Consistent mac addresses is also a requirement for stable networking (#8297)
since re-using the same IP address on a different MAC address triggers the ARP
issue.

Finally, this change makes the MAC address accessible through docker
inspect, which fixes #4033.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
Upstream-commit: 88e21c6a75310da158bbee3a5fdc135697c93ba1
Component: engine
2014-10-03 13:22:38 -07:00
317547ae8d Implementing IPv6 functionality for ipallocator
Closes #6975

Signed-off-by: Malte Janduda <mail@janduda.net>
Upstream-commit: f5f4d2d9cbeefb1d896d987a87058eeb65b4ebf6
Component: engine
2014-10-02 00:25:02 +02:00
500b118084 IPAllocator: Ensure the allocated IPs are within network range.
Since it is possible to request a specific IP, IPAllocator has to verify
that the request is within boundaries.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
Upstream-commit: a471eb4d9388dc44be0a9c81fa2f15061df636c5
Component: engine
2014-09-24 11:04:28 -07:00
5f2492cd77 Merge pull request #8125 from somaopensource/8102-fix
Check whether net.ParseIP returned nil or not
Upstream-commit: 4778d7d52d97666b3c7d886861f30a39ecc1bb24
Component: engine
2014-09-22 23:00:25 +04:00
eb02e608df Merge pull request #6101 from LK4D4/ip_range_#4986
Implement allocating IPs from CIDR within bridge network 
Upstream-commit: 9fb34ae5710faaadc730a7005f785cefc56eed4b
Component: engine
2014-09-22 17:09:16 +03:00
d6c649f11a Check whether net.ParseIP returned nil or not
This is fix of #8102

Signed-off-by: Oh Jinkyun <tintypemolly@gmail.com>
Upstream-commit: c2dc4245f1fb9462d0f22e0bc2aceb02903211ab
Component: engine
2014-09-22 16:52:23 +09:00
3a9c8d29c9 This reduces the amount of logging in the integration tests
There were a new areas in the brige driver that did not need to have log
output.  Those were removed.  Also set the engine's logging to false
when running the integration tests.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 8a9e827216eb5db4fcbe67c3c638f9e85f4de9bf
Component: engine
2014-09-19 17:30:37 -07:00
9ba82afe29 Add an option to disable IP masquerading
For the cases where --bip option is used it is sometimes best to disable
IP masquerading as the provided bridge IP range may be routable.

Signed-off-by: Eugene Yakubovich <eugene.yakubovich@coreos.com>
Upstream-commit: 4dc4d56db9797159e2e329845e0b94e3e0f780a0
Component: engine
2014-09-16 20:00:15 -07:00
06ff531f43 Fix my own comments from #7927
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 41e9e93e27ccd637d9490412622529bdc7d7b8ff
Component: engine
2014-09-12 10:05:07 +04:00
9e31fe0a00 Fix an issue where already allocated ports would not trigger an error.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 3b6a29b81a5280187b3d03c91950cf93f7e263ec
Component: engine
2014-09-12 09:51:14 +04:00
73455edf0c Deallocate port before trying to delete iptables chain
Fixes #7954
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 2e7cf6b0cec3e5cc6f05fa5011cf7b5e49a44ae4
Component: engine
2014-09-10 00:40:46 +04:00
b1d4f5b84e Implement allocating IPs from CIDR within bridge network
Fixes #4986

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: b101022dbe6daa36ebf11df53ad01a399a655963
Component: engine
2014-08-29 16:21:07 +04:00
b6b24f8f8a More ipallocator refactoring
Now x1.5 faster

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 42dd48315fcf6a3a536e0e698396e404246b9f3f
Component: engine
2014-08-29 16:20:49 +04:00
04c32fc20e Skip "no chain" error on deleting chain in Unmap
Fixes #6904
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: bd049b3800b967bba06d03fd23ab135c51467ae3
Component: engine
2014-08-27 20:24:27 +04:00
0bb709c134 remove double newline
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: fcf37be2b1efa11da1958658da0e04755a225c89
Component: engine
2014-08-14 01:08:27 +00:00
4737f7cea5 Extract log utils into pkg/log
Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
Upstream-commit: a02f67be5b17da63d475e6f35956c1e72c3b2e7b
Component: engine
2014-08-13 15:18:15 -07:00
b3e9a7cd3b Move userland proxies out of daemon's process
This PR moves the userland proxies for TCP and UDP traffic out of the
main docker daemon's process ( from goroutines per proxy ) to be a
separate reexec of the docker binary.  This reduces the cpu and memory
needed by the daemon and if the proxy processes crash for some reason
the daemon is unaffected.  This also displays in the standard process
tree so that a user can clearly see if there is a userland proxy that is
bound to a certain ip and port.

```bash
CONTAINER ID        IMAGE                       COMMAND             CREATED             STATUS              PORTS                                          NAMES
5d349506feb6        busybox:buildroot-2014.02   "sh"                13 minutes ago      Up 1 seconds        0.0.0.0:49153->81/tcp, 0.0.0.0:49154->90/tcp   hungry_pike
root@1cbfdcedc5a7:/go/src/github.com/docker/docker# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1  18168  3100 ?        Ss   21:09   0:00 bash
root      8328  0.7  0.6 329072 13420 ?        Sl   22:03   0:00 docker -d -s vfs
root      8373  1.0  0.5 196500 10548 ?        Sl   22:03   0:00 userland-proxy -proto tcp -host-ip 0.0.0.0 -host-port 49153 -container-ip 10.0.0.2 -container-port 81
root      8382  1.0  0.5 270232 10576 ?        Sl   22:03   0:00 userland-proxy -proto tcp -host-ip 0.0.0.0 -host-port 49154 -container-ip 10.0.0.2 -container-port 90
root      8385  1.2  0.0   3168   184 pts/0    Ss+  22:03   0:00 sh
root      8408  0.0  0.1  15568  2112 ?        R+   22:03   0:00 ps aux
```

This also helps us to cleanly cleanup the proxy processes by stopping
these commands instead of trying to terminate a goroutine.

Signed-off-by: Michael Crosby <michael@docker.com>
Upstream-commit: b4e2f5ed962f8ef81dbc2cbb1ff2a06bb64f8211
Component: engine
2014-08-13 11:54:47 -07:00
00b87e1af9 Fix go vet warnings
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 391c35c82252633eb415fdade08103a8a0818fde
Component: engine
2014-08-13 11:37:30 +04:00
625730681d Merge pull request #7100 from discordianfish/fix-port-allocation
Fix masked err in portmapper
Upstream-commit: 19c8e74fd3deeae7a22eb4c502acd2b9f3072ab0
Component: engine
2014-07-30 23:51:21 +03:00
e25f77248d Move parsing functions to pkg/parsers and the specific kernel handling
functions to pkg/parsers/kernel, and parsing filters to
pkg/parsers/filter. Adjust imports and package references.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 4398108433121ce2ac9942e607da20fa1680871a
Component: engine
2014-07-29 13:09:10 -07:00
3513533d24 Make sure err never gets masked
Defining err as named return parameter will make sure the variable gets
assigned before returning and thus avoid masking

Docker-DCO-1.1-Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org> (github: discordianfish)
Upstream-commit: 32bc8658793b278c793cb8755b94df3b210bea5d
Component: engine
2014-07-25 17:00:41 +02:00
2273fb0f55 gofmt -s -w
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: 5a0ef08c940b9a17c400389bca8e7f54935ceba9
Component: engine
2014-07-24 22:25:29 +00:00
6ae4c9014c update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: b3ee9ac74e171e00f14027e39278013629e681b8
Component: engine
2014-07-24 22:19:50 +00:00
d2349e06da Change switch to if so that the break statements correctly breaks loop
Docker-DCO-1.1-Signed-off-by: Kohei Tsuruta <coheyxyz@gmail.com> (github: coheyxyz)
Upstream-commit: ffe885ec0e8a06c1614949bf383f6d1532f02c1d
Component: engine
2014-07-17 20:27:29 +09:00
ea789048c6 Merge pull request #6799 from LK4D4/refactor_portallocator
Refactoring portallocator
Upstream-commit: 3993f9d5818f344199c3b13ae8aa9e6bee22479e
Component: engine
2014-07-07 12:39:36 -07:00
6a68c558b1 Merge pull request #6371 from jpetazzo/6370-masquerade
Select masquerade by outgoing interface rather than by destination subne...
Upstream-commit: bcec0f30e8d7dbb9fcdd6a85fa4b8e4953ba66ff
Component: engine
2014-07-07 10:28:31 -07:00