Commit Graph

18 Commits

Author SHA1 Message Date
Dominik Honnef 6f9a67a7c7 Make IP allocator lazy
Instead of allocating all possible IPs in advance, generate them as
needed.

A loop will cycle through all possible IPs in sequential order,
allocating them as needed and marking them as in use. Once the loop
exhausts all IPs, it will wrap back to the beginning. IPs that are
already in use will be skipped. When an IP is released, it will be
cleared and be available for allocation again.

Two decisions went into this design:

1) Minimize memory footprint by only allocating IPs that are actually
in use

2) Minimize reuse of released IP addresses to avoid sending traffic to
the wrong containers

As a side effect, the functions for IP/Mask<->int conversion have been
rewritten to never be able to fail in order to reduce the amount of
error returns.

Fixes gh-231
2013-04-01 06:02:44 +02:00
Shawn Siefkas 523803d633 Handling iptables() errors more usefully during portmapper setup 2013-03-28 14:44:54 -05:00
Shawn Siefkas c66d2b6a53 Return error when iptables is not found 2013-03-28 14:30:56 -05:00
Shawn Siefkas dfc3904f77 Looking for iptables in PATH 2013-03-28 14:02:50 -05:00
Guillaume J. Charmes 51455b1ee0 Merge pull request #138 from srid/handle-port-mapper-error
handle errors during the creation of port mapper
2013-03-24 10:27:03 -07:00
Sridhar Ratnakumar 371225520f handle errors during the creation of port mapper
example:

  2013/03/22 21:42:55 Unable to setup port networking: Failed to create DOCKER chain

  (which was possibly introduced by commit 3c6b8bb88)
2013-03-22 21:44:01 -07:00
Solomon Hykes 301a8afff5 Properly cleanup iptables rules inserted in OUTPUT (introduced in 3c6b8bb888) 2013-03-22 22:31:20 -07:00
Shawn Siefkas 3c6b8bb888 Fixing Issue #98: Adding DOCKER to output chain during iptables setup 2013-03-22 11:28:15 -05:00
shin- 3aefed2dc2 When lxcbr0 has several associated IPs, default to first one found 2013-03-21 09:19:22 -07:00
creack ab99e9252d Complete pull request #121, init TCPAddr with named field 2013-03-20 06:02:25 -07:00
ezbercih fac32cda5a Fix issue #120, initialize TCPAddr w/ field names
Current Go tip (+74e65f07a0c8) and likely Go 1.1 does not build docker since net.TCPAddr struct has an additional field now for IPv6:

type TCPAddr struct {
    IP   IP
    Port int
    Zone string // IPv6 scoped addressing zone
}

Initializing the struct with named fields resolves this problem.
2013-03-21 00:11:16 -03:00
Andrea Luzzardi 799ffa1763 Network: Port mapping support.
Implemented a port allocator and a port mapper that is able to forward TCP ports
from the host to the container.
2013-02-28 11:50:02 -08:00
Andrea Luzzardi c08f5b2b84 Integrated the network allocator into Docker. A networking environment
is assigned to each container upon Start and released whenever the
container exits.
2013-02-25 14:06:22 -08:00
Andrea Luzzardi 797bb6e75b Network allocator 2013-02-25 10:45:23 -08:00
Andrea Luzzardi e0e49b9a22 Network: Do not assume that we are using a class C. Instead, compute the
IP addresses range and network size in order to allocate an IP address.
2013-02-21 18:33:23 -08:00
Andrea Luzzardi 6124c5eb31 Network: Simple random IP allocation on the bridge network. 2013-02-21 10:47:57 -08:00
Andrea Luzzardi 5039d4a280 Network: Automatically figure out the gateway and netmask by inspecting
the lxc bridge interface
2013-02-21 10:47:57 -08:00
Andrea Luzzardi 5cecd548cd Basic networking support with hardcoded addresses. Work in progress. 2013-02-21 10:47:57 -08:00