Граф коммитов

87 Коммитов

Автор SHA1 Сообщение Дата
Christian Simon 4307ec283b [WiP] Adds testing for bridge's IPv6 support
* fixes #10001
* test for global subnets <= 80
* test for global subnets > 80
* test link local allocations
* test duplicated addresses
* test regression from bug #11427

Signed-off-by: Christian Simon <simon@swine.de>
2015-03-18 08:51:14 +01:00
Vishnu Kannan 39d49ba7ba Reduce logging level from error to warning if "/proc/sys/net/ipv4/ip_local_port_range" proc file in not accessible.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2015-03-17 17:39:17 +00:00
Jessie Frazelle 213be9ee27 Merge pull request #11427 from LK4D4/fix_alloc_ip6
Fix IPv6 autoallocation from mac with --ipv6-cidr
2015-03-16 16:38:46 -07:00
Michael Crosby 88f437d6c6 Merge pull request #11402 from miminar/err-cleanup
Error formatting cleanups
2015-03-16 16:13:16 -07:00
Alexander Morozov 491f8ab144 Fix IPv6 autoallocation from mac with --ipv6-cidr
We used slice globalIPv6Network.IP itself, not its copy as expected.

Fixes #10774

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-16 15:36:50 -07:00
Lars Kellogg-Stedman 3559b4177e fix various problems with iptables.Exists
This modifies iptables.Exists so that it must be called with an explicit
table and chain.  This allows us (a) to generate an appropriate command
line for "iptables -C", which was not previously possible, and (b) it
allows us to limit our strings.Contains() search to just the table and
chain in question, preventing erroneous matches against unrelated rules.

Resolves #10781

Signed-off-by: Lars Kellogg-Stedman <lars@redhat.com>
2015-03-16 17:14:45 -04:00
Michal Minar 210ab030bc Format error by value
- Use `%v` verb to format errors.
- Give `param` constant in portallocator some better name.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-03-16 12:05:53 +01:00
Michal Minar 40d5406371 Pass buffered file reader to Fscanf instead of string reader
Unless `file` is wrapped with buffered reader, `fmt.Fscanf` will read
just one byte and terminate with `EOF`.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-03-13 09:40:53 +01:00
Michal Minar 0dcc970432 Restructured port range loader
And renamed `GetPortRange` to `PortRange`.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-03-10 10:02:43 +01:00
Michal Minar fcf8e85a35 Use default port range in unit tests
Signed-off-by: Michal Minar <miminar@redhat.com>
2015-03-09 16:58:14 +01:00
Michal Minar 0eb3544c43 Use system's ephemeral port range for port allocation
Read `/proc/sys/net/ipv4/ip_local_port_range` kernel parameter to obtain
ephemeral port range that now sets the boundaries of port allocator
which finds free host ports for those exported by containers.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-03-09 09:13:20 +01:00
Sven Dowideit 4e5ea0c875 Seems like an un-necessary if statement
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2015-03-04 13:24:17 -08:00
Zen Lin(Zhinan Lin) 2c0e027ab9 Just format some logs and notes in /daemon/networkdriver/bridge/driver.go
Signed-off-by: Zen Lin(Zhinan Lin) <linzhinan@huawei.com>
2015-03-03 23:39:04 +08:00
Zen Lin(Zhinan Lin) e5bc50b5cd fix err in note at daemon/networkdriver/bridge/driver.go
Signed-off-by: Zen Lin(Zhinan Lin) <linzhinan@huawei.com>
2015-03-03 00:52:53 +08:00
Michael Crosby ffc499dbab Merge pull request #10215 from taohu/remove-assumption-first-ip-is-bridge-ip
Remove the assumption that the first IP is the bridge IP
2015-02-06 14:15:46 -08:00
Erik Hollensbe 8d7683af86 Remove "OMG IPV6" log message
Signed-off-by: Erik Hollensbe <erik+github@hollensbe.org>
2015-01-31 13:21:06 -08:00
Phil Estes 0c8d17b5c1 Fix bridge initialization for IPv6 if IPv4-only docker0 exists
This fixes the daemon's failure to start when setting --ipv6=true for
the first time without deleting `docker0` bridge from a prior use with
only IPv4 addressing.

The addition of the IPv6 bridge address is factored out into a separate
initialization routine which is called even if the bridge exists but no
IPv6 addresses are found.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-01-27 23:54:26 -05:00
Jonathan Rudenberg d5c78a4c07 Fix missing err assignment in bridge creation
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
2015-01-23 14:48:28 -08:00
Hu Tao 8ec6c692db Remove the assumption that the fist IP is the bridge IP
The assumption is not true if user specifies an IP address other than
the first IP, in that case the first IP address is never allocated to
any container.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2015-01-21 02:13:58 +08:00
Malte Janduda 813ff7f19d Adding IPv6 network support to docker
Signed-off-by: Malte Janduda <mail@janduda.net>
2015-01-09 00:13:09 +01:00
Malte Janduda f4551b8a48 Remove BridgeIP from ipallocation pool
Closes #9938

Signed-off-by: Malte Janduda <mail@janduda.net>
2015-01-08 16:21:09 +01:00
Ian Bishop 38a595aec5 Tidy driver.go/LinkContainers
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
2014-12-21 13:42:02 +10:00
Ian Bishop 0da92633b4 Create tests for pkg/iptables
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
2014-12-21 12:57:32 +10:00
Porjo 2865373894 Create DOCKER forward chain on driver init
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
2014-12-21 12:57:32 +10:00
Porjo cc89b30d35 Move per-container forward rules to DOCKER chain
Docker-DCO-1.1-Signed-off-by: Ian Bishop <ianbishop@pace7.com> (github: porjo)
2014-12-21 12:57:32 +10:00
Alexandr Morozov a00a1a1fca 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>
2014-12-01 16:26:30 -08:00
Vincent Batts a43ee077dc Merge pull request #9149 from swagiaal/fix-configureBridge-comment
Remove reference to 'ifaceName' from configureBridge comment.
2014-11-21 16:37:28 -05:00
Jessica Frazelle f6c7194539 Apply same typed iptables errors to network driver.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-11-20 18:07:15 -08:00
Alexandr Morozov 72c55e8215 Increase timeout for userland proxy starting
Fixes #8883

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-20 09:02:42 -08:00
Arnaud Porterie 34cb92e2d4 Merge pull request #8699 from shuai-z/fix-portalloc
Fix corner cases in ipallocator and portallocator
2014-11-16 22:10:40 -08:00
Sami Wagiaalla a01f1e707e 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>
2014-11-13 10:19:56 -05:00
Tibor Vass fa59fe997c Merge pull request #8877 from erikh/proxy_error_check
proxy: Fix a potential panic handling error states.
2014-11-04 11:40:02 -05:00
shuai-z 4c97832297 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>
2014-11-04 13:46:53 +08:00
Srini Brahmaroutu fd774a818c adding support for port ranges on --expose
Closes #1834

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-10-31 23:06:30 +00:00
Erik Hollensbe ad5b307d0f proxy: Fix a potential panic handling error states.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
2014-10-31 04:20:26 +00:00
unclejack acd64278f1 pkg/reexec: move reexec code to a new package
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-10-30 14:48:30 +02:00
Alexandr Morozov 4da2572424 Fix compilation issue bringed by #8319
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-29 09:31:35 -07:00
Jessie Frazelle fd19e473fc Merge pull request #8319 from MalteJ/ipv6-ipallocator
Implementing IPv6 functionality for ipallocator
2014-10-29 09:20:52 -07:00
Alexandr Morozov ee7dd44c01 Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:11:48 -07:00
Alexandr Morozov 7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Michael Crosby 0e6242122d Merge pull request #8671 from shuai-z/master
Port number 49153(BeginPortRange) would be returned twice, causing dupli...
2014-10-23 17:37:38 -07:00
Phil Estes 1262b5f605 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)
2014-10-23 16:19:12 -04:00
shuai-z 2c2edabca5 added test, gofmtd
Signed-off-by: shuai-z <zs.broccoli@gmail.com>
2014-10-23 11:35:12 +08:00
shuai-z 9451cf39ef 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>
2014-10-23 10:49:33 +08:00
Daniel, Dao Quang Minh 3b9d88210e 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)
2014-10-08 12:53:43 -04:00
Andrea Luzzardi 88e21c6a75 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>
2014-10-03 13:22:38 -07:00
Malte Janduda f5f4d2d9cb Implementing IPv6 functionality for ipallocator
Closes #6975

Signed-off-by: Malte Janduda <mail@janduda.net>
2014-10-02 00:25:02 +02:00
Andrea Luzzardi a471eb4d93 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>
2014-09-24 11:04:28 -07:00
Alexandr Morozov 4778d7d52d Merge pull request #8125 from somaopensource/8102-fix
Check whether net.ParseIP returned nil or not
2014-09-22 23:00:25 +04:00
unclejack 9fb34ae571 Merge pull request #6101 from LK4D4/ip_range_#4986
Implement allocating IPs from CIDR within bridge network
2014-09-22 17:09:16 +03:00