Commit Graph

41 Commits

Author SHA1 Message Date
Hongjiang Zhang 027fc3483b
Add bridge and driver code for FreeBSD specifically 2017-08-14 19:32:21 -07:00
Ke Li a3aa25c794 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Madhu Venugopal 0bf056d59f Windows overlay driver support
1. Base work was done by msabansal and nwoodmsft
   from : https://github.com/msabansal/docker/tree/overlay
2. reorganized under drivers/windows/overlay and rebased to
   libnetwork master
3. Porting overlay common fixes to windows driver
    * 4658085
    * bb736c4
    * f6d8968
4. Windows Service Discovery changes for swarm-mode
5. renaming default windows ipam drivers as "windows"

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Signed-off-by: msabansal <sabansal@microsoft.com>
Signed-off-by: nwoodmsft <Nicholas.Wood@microsoft.com>
2016-11-03 16:50:04 -07:00
Yong Tang e02f9e9a49 Fix issue for `--fixed-cidr` when bridge has multiple addresses
This fix tries to address the issue raised in:
https://github.com/docker/docker/issues/26341
where multiple addresses in a bridge may cause `--fixed-cidr` to
not have the correct addresses.

The issue is that `netutils.ElectInterfaceAddresses(bridgeName)`
only returns the first IPv4 address.

This fix changes `ElectInterfaceAddresses()` and `addresses()`
so that all IPv4 addresses are returned. This will allow the
possibility of selectively choose the address needed.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-10-21 13:58:16 -07:00
Puneet Pruthi 566903dd7b libnetwork support for Solaris
Signed-off-by: Puneet Pruthi <puneetpruthi@gmail.com>
2016-10-14 16:38:23 -07:00
Jana Radhakrishnan fda4c19b7a Fix CircleCI
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-08-30 12:23:19 -07:00
Jana Radhakrishnan b33b7c68a5 Merge pull request #1205 from allencloud/fix-typos
use grep to find a/an misuse
2016-08-01 09:49:31 -07:00
bin liu 21c5a6281b fix typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2016-06-22 14:20:30 +08:00
Alessandro Boch cfc89ef193 Migrate libnetwork to use netlink.Handle
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-08 21:05:36 -07:00
allencloud 8acef98c5f use grep to find a/an misuse
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-03 16:35:33 +08:00
Alessandro Boch c378054576 Fix cross compilation issues
- Fix circle-ci-cross target
- Remove unsupported os/arch targets
- Fix dnet build for windows/amd64
- Fix a solaris build breakage

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-21 11:20:01 -07:00
Jana Radhakrishnan 5ca79d6b87 Remove all netlink/osl deps from ipam/ipamutils
Currently ipam/ipamutils has a bunch of dependencies
in osl and netlink which makes the ipam/ipamutils harder
to use independently with other applications. This PR
modularizes ipam/ipamutils into a standalone package
with no OS level dependencies.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-10 11:05:39 -07:00
Santhosh Manohar 888c509c5c Retain V6 DNS server in resolv.conf; use only V4 servers for fallback
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-01-19 00:06:19 -08:00
Madhu Venugopal f0b958dd71 alias support in dnet and integration-tests
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-01-07 14:50:29 -08:00
Santhosh Manohar e9400f356e Embedded DNS server
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-01-07 00:25:26 -08:00
Dave Tucker 7ddd97684e Multi-Arch Support
Compile the dnet tool for Linux (x86, amd64 and arm)
and Windows (x86 and amd64)

- Moved installation of dependencies into `Dockerfile.build`
- Remove `start-services` from Makefile
   - That's the responsibility of Docker or build environment
- Removed utils depending on `netlink` from `netutils/utils.go`

Unable to add `make cross` to CircleCI just yet as there are some
issues to solve that are unrelated to this PR

Also fix `.gitignore` which was not updated after changing the build
image name in #667

Signed-off-by: Dave Tucker <dt@docker.com>
2015-11-25 22:47:41 +00:00
Alexander Morozov a815036c2f 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 3afcd65d6e 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 b784a13c94 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 0dca75517b Merge pull request #442 from aboch/csb
Simplify NetworkOverlaps function
2015-08-18 09:04:02 -07:00
Alessandro Boch e295febf03 network byte order to bitseq serializer
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-16 09:38:17 -07:00
Alessandro Boch 351330bc19 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 20e2079cfb 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 dbe6172d8c 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 2c26fdf8df Add serialize/deserialize for sequence list
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-17 16:37:59 -07:00
Jana Radhakrishnan 0197028220 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 7783fcd13f 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 d8ba1e2310 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 a971716f29 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 de690d7348 Add some tests
Signed-off-by: Mingzhen Feng <fmzhen@zju.edu.cn>
2015-05-08 15:00:59 +08:00
bin liu 51ec188af7 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-05-07 09:22:06 +00:00
Alessandro Boch f21785e451 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 3678144103 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 418da5befb 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 eee24e4cec Merge pull request #110 from aboch/ed
Provide API to retrieve Endpoint operational data
2015-05-04 16:50:11 -07:00
Madhu Venugopal 8e3458283e 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 f42056ad40 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 18e3679789 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 c60935a41a 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 6adf1defbb 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 c14c967d85 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