1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

25 commits

Author SHA1 Message Date
Alexander Morozov
537ba03dd1 Use netlink.LinkByName instead of net.InterfaceByName
It's x350 time faster.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-10-16 11:33:17 -07:00
David Calavera
cc02894a50 Move test specific functions to a testutils package.
This way we won't vendor test related functions in docker anymore.
It also moves netns related functions to a new ns package to be able to
call the ns init function in tests. I think this also helps with the
overall package isolation.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-07 13:33:28 -04:00
Jana Radhakrishnan
bcd996f4c3 Explicitly set namespace for all network operations
Make sure to always explicitly set namespace for all
kernel bound network operations irrespective of whether
the operation is performed in init namespace or a user
defined namespace. This already happens for user defined
netns. But doesn't happen for initial netns that libnetwork
runs in.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-09-01 14:00:58 -07:00
Jana Radhakrishnan
7f15aee70e Merge pull request #442 from aboch/csb
Simplify NetworkOverlaps function
2015-08-18 09:04:02 -07:00
Alessandro Boch
e5842be694 network byte order to bitseq serializer
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch
26ac09e004 Simplify NetworkOverlaps function
- Doing a lot of unnecessary things.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-06 10:14:35 -07:00
Alessandro Boch
3da75632f7 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
Alessandro Boch
6461057521 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
75443aaf72 Add serialize/deserialize for sequence list
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-17 16:37:59 -07:00
Jana Radhakrishnan
6d6aeff780 Make GenerateIfaceName generic
Currently GenerateIfaceName is defined in bridge.go
and it specifically tries to only generate an interface
name only with `veth` prefix. Make it generic so that it
can accept a prefix and length of random bytes. Also
move it to netutils since it is useful to generate various
kinds of interface names using it.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-06-08 09:49:17 -07:00
Jana Radhakrishnan
a9fa764cbb Move network types to types package
This is need to decouple types from netutils which has linux
dependencies. This way the client code which needs network types
can just pull in types package which makes client code platform
agnostic.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-20 20:28:46 +00:00
Jana Radhakrishnan
b323d571b5 Driver api refactor
Refactored the driver api so that is aligns well with the design
of endpoint lifecycle becoming decoupled from the container lifecycle.
Introduced go interfaces to obtain address information during CreateEndpoint.
Go interfaces are also used to get data from driver during join.
This sort of deisgn hides the libnetwork specific type details from drivers.

Another adjustment is to provide a list of interfaces during CreateEndpoint. The
goal of this is many-fold:
     * To indicate to the driver that IP address has been assigned by some other
       entity (like a user wanting to use their own static IP for an endpoint/container)
       and asking the driver to honor this. Driver may reject this configuration
       and return an error but it may not try to allocate an IP address and override
       the passed one.
     * To indicate to the driver that IP address has already been allocated once
       for this endpoint by an instance of the same driver in some docker host
       in the cluster and this is merely a notification about that endpoint and the
       allocated resources.
     * In case the list of interfaces is empty the driver is required to allocate and
       assign IP addresses for this endpoint.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-18 22:36:00 +00:00
Jana Radhakrishnan
10fafb06eb Fixed an intermittent issue in the libnetwork test
The libnetwork test does not need to run inside a namespace
when inside a container. This results in unpredictable behavior
when the sandbox code unlocks the go routine from the OS thread
while the test code still wants it locked in the OS thread. This
will result in unreachable interfaces when the go routine
migrates to a different OS thread.

Fixed by passing a special test flag which is only set to true
when the test is run inside a container.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-13 00:22:00 +00:00
Mingzhen Feng
0db03ebaa3 Add some tests
Signed-off-by: Mingzhen Feng <fmzhen@zju.edu.cn>
2015-05-08 15:00:59 +08:00
bin liu
e1003fb078 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-05-07 09:22:06 +00:00
Alessandro Boch
ec4e1da3c5 Separate ExposedPorts from PortBindings in libnetwork API
- Fix missing code in tests in 64cceb37ad1c16884d709fd49fba34e8a99d8c41

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-05 16:17:17 -07:00
Madhu Venugopal
d4851b95ec Incorrect assumption with golang net package causes Overlapping IP
using a len(net.IP) to check for ipv4 or ipv6 is a bad idea.
And that was exactly done in NetworkOverlaps() function with the
assumption that any ipv4 net.IP will be of 4 bytes. Golang Net package
makes no such assumptions.

This assumption actually broke a particular use-case where the
NetworkOverlaps fails to identify a genuine overlap and that causes
datapath issues.

With this fix, we explicitely check for v4 or v6

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-04 22:31:16 -07:00
Jana Radhakrishnan
560d156e36 Replaced all proto numbers in netutils with the defined const
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-05 00:16:36 +00:00
Madhu Venugopal
def2a1192f Merge pull request #110 from aboch/ed
Provide API to retrieve Endpoint operational data
2015-05-04 16:50:11 -07:00
Madhu Venugopal
30e2ee9793 Fix a minor but in utils parsing UDP/TCP ports
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-04 16:28:51 -07:00
Alessandro Boch
56741e7d60 Provide API to retrieve Endpoint operational data
- from the driver

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-04 14:54:48 -07:00
Alessandro Boch
da1cddc320 Bridge to handle port mapping
- libnetwork cares for list of exposed ports, driver cares
  for list of port bindings. At endpoint creation:
  - list of exposed ports will be passed as libnetwork otion
  - list of port mapping will be passed as driver option

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-02 23:25:01 -07:00
Alessandro Boch
95958d7610 Enhance Endpoint interface
- Added new getter methods
- Modified signature of Network.CreateEndpoint()

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-04-20 03:21:01 -07:00
Brent Salisbury
d8f88b2afb Name/Mac generation and libcontainer dep removal
- Modified Mac address generation to match current standard
- Moved GenerateRandomName from libcontainer and removed the dependancy.
- Reduced entropy loop to 3 attempts.

Signed-off-by: Brent Salisbury <brent.salisbury@docker.com>
2015-04-14 18:10:52 -04:00
Jana Radhakrishnan
68ae284db5 Libnetwork refactor for container network model
- Added controller, network, endpoint and sandbox interfaces
    - Created netutils package for miscallaneous network utilities
    - Created driverapi package to break cyclic dependency b/w driver and libnetwork
    - Made libnetwork multithread safe
    - Made bridge driver multithread safe
    - Fixed README.md

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-13 21:40:50 +00:00