Commit Graph

53 Commits

Author SHA1 Message Date
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
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
e3c0c2772d Refactoring portallocator
Faster, more documented, less code.
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: f387cc1205b79ffbe30b28f5df13da034d8221fd
Component: engine
2014-07-01 21:59:11 +04:00
229de7479e portmapper: unit tests for remap problem
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 2cdcfc0c57e375955d3ed7c8e1487f9d4751b255
Component: engine
2014-06-27 15:57:31 -07:00
4ad46ffe31 Use last allocated port logic in port allocator
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: e77729c2e081c5ce55aa1d4f316b7c7703e5de96
Component: engine
2014-06-27 10:51:26 -07:00
52ddc2736f Make ErrPortAlreadyAllocated an error interface with a few extras,
adjust tests to fit.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: ffd68badc0a3d70fbd063903702355a387621b10
Component: engine
2014-06-27 10:51:25 -07:00
187971736c Restrict portallocator to Docker allocated ports
Port allocation status is stored in a global map: a port detected in use will remain as such for the lifetime of the daemon. Change the behavior to only mark as allocated ports which are claimed by Docker itself (which we can trust to properly remove from the allocation map once released). Ports allocated by other applications will always be retried to account for the eventually of the port having been released.

Docker-DCO-1.1-Signed-off-by: Arnaud Porterie <icecrime@gmail.com> (github: icecrime)
Upstream-commit: dafddf461eeabd792d9ced6caced75ad6961c1d7
Component: engine
2014-06-27 10:51:25 -07:00
363db75bc0 Select masquerade by outgoing interface rather than by destination subnet
Docker-DCO-1.1-Signed-off-by: Jérôme Petazzoni <jerome@docker.com> (github: jpetazzo)
Upstream-commit: a084f4bc61a81eb9076246d85d6cc5168b32a949
Component: engine
2014-06-11 17:09:19 -07:00
52b8a282c3 Update libcontainer imports
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 8194556337b65dda71a3d4d7f6ae9653ad5a19a0
Component: engine
2014-06-10 19:58:15 -07:00
3c7670e68c Move libcontainer deps into libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Upstream-commit: 6158ccad97db51e756aafefb096d1163aa4d6439
Component: engine
2014-06-09 15:52:12 -07:00
bfa0c1d204 Fix races in set/get currentInterfaces in networkdriver
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: 4e5f6951f2af836c3d9163c8a150298ee87468d4
Component: engine
2014-05-30 14:16:00 +04:00
d8e73d4132 Ip allocator refactoring
We don't need ordered set anymore, also some cleanings and simple
benchmark.
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: ef94ac7d2fd42a09c99567b0393fb48b9d782a9e
Component: engine
2014-05-27 22:56:26 +04:00
1e8e32fb77 bridge: retry any proxy set up failures until we get a successful port, defeats a race condition
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 91ba3379312a74132e2578d167c9e36eeb889525
Component: engine
2014-05-21 09:14:53 -07:00
ff6d32db91 portallocator: rewrite to simplify, removes race condition
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: f0489ce3a9a4023265bbbd5e9cb333e95f950088
Component: engine
2014-05-21 09:14:53 -07:00
3b48f8f4bc Change ip allocation logic
Now IP reuses only after all IPs from network was allocated
Fixes #5729

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: 80fca061e7661549a05b2696488db3fea008e2dd
Component: engine
2014-05-14 06:43:10 +04:00