Commit Graph

34 Commits

Author SHA1 Message Date
Ke Li 23ac56fdd0 Remove unnecessary string formats
Signed-off-by: Ke Li <kel@splunk.com>
2016-11-22 09:29:53 +08:00
Daehyeok Mun 7f473c779a Refactoring logrus import and formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.
Also fix import name to use original project name 'logrus' instead of
'log'

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2016-11-08 12:42:41 -07:00
Yong Tang 53bf987984 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
Alessandro Boch 6d3fa9e0f2 Migrate libnetwork to use netlink.Handle
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-08 21:05:36 -07:00
Alessandro Boch af3eb25d44 Phase-2 bridge driver changes to support IPAM
- Set bridge ipv4 address when bridge is present
- IPv6 changes for bridge
- Convert unit tests to the new model

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-10-08 16:22:03 -07:00
Madhu Venugopal f2f536032b Phase-1 bridge driver changes to support IPAM
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-10-08 14:26:58 -07:00
Madhu Venugopal a41025e9c0 Fixed a few more issues observed during docker integration
- DisableBridgeCreation is misleading. change it to DefaultBridge
- Dont fail the init if localstore cannot be initialized
- added a convenience function to get endpoint for a container

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-25 09:40:42 -07:00
Madhu Venugopal a42e5f0663 Flip the default for the flag AllowNonDefaultBridge in bridge driver
Replaced it with DisableBridgeCreation and it can be used ONLY in
a special case for docker0 bridge from docker, instead of calling it
from all other case.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-09-24 02:18:35 -07:00
Alessandro Boch cd3fbc2a95 Fixes ip allocation for multi bridge networks
- Do not discard errors on ip allocation for gw and bridge
- Release addresses on network delete
- Add some context on top of ipallocator returned error
- Create ip allocator instance at driver creation, not at package init,
  otherwise this affects bridge test code where ip db is carried over
  test functions

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-27 20:39:30 -07:00
Tomas Kral 5a259d55f0 modify /proc/sys only if needed
fixes #405

Signed-off-by: Tomas Kral <tomas.kral@gmail.com>
2015-08-05 13:46:28 +02:00
Alessandro Boch e8771c868e Bug in bridge network mask
- that was causing all networks to be /24

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-08-03 16:11:06 -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 88c2c05ce9 Misc fixes to ip allocation in bridge driver
Two changes were missing:
- On allocation of bridge ip was not passing canonical subnet
- Canonical subnet has to be passed on ip release
  as well, otherwise ipallocator will attempt
  ip release from a non registered nw

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-07-24 16:59:27 -07:00
Alessandro Boch 3d805de246 Pass a canonical subnet to ipallocator
- Currently both network and host bits in the subnet are passed
  when requesting an address from ipallocator.
  The way ip allocator determines the first available
  IP is tainted when caller passes the subnet host bits.

- Verified this patch applied to libnetwork vendored in docker
  fixes the issue when starting the daemon.

- Fixes #287

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-06-12 00:20:43 -07:00
Alessandro Boch 35fab0aa6f Bridge driver to support multiple networks
Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-24 07:59:34 -07:00
Alessandro Boch 5d9c59e523 Support network options in rest api
- Also unexporting configuration structures in bridge
- Changes in dnet/network.go to set bridge name = network name

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-23 20:12:29 -07:00
Alessandro Boch c70cfcb150 Provide interface to categorize errors
- Package types to define the interfaces libnetwork errors
  may implement, so that caller can categorize them.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-20 22:29:29 -07:00
Alessandro Boch 902e8746d3 Optional Userland Proxy
- Port https://github.com/docker/docker/pull/12165 to libnetwork
- More tests will be added later

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-05-18 18:13:39 -07:00
Jana Radhakrishnan 94a9f12280 Moved most of the driver configuration to network configuration.
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-06 17:43:24 +00: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 68cae04fe9 Fixed a bug in bridge driver when docker0 has no IP
address it doesn't select and configure a proper IP address.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-05-05 00:09:11 +00:00
Alessandro Boch 35693a1a47 Issue #88: Handle default v4/v6 gw setting
- Basically this is porting docker PR #9381 to libnetwork
- Added a Config.Validate() method where to consolidate
  a priori validation of bridge configuration
- Have bridgeInterface store the current v4/v6 default gateways
- Introduced two setupStep functions to set the requested def gateways

Signed-off-by: Alessandro Boch <aboch@docker.com>
2015-04-28 13:48:28 -07:00
bin liu a004b52ab3 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2015-04-20 04:12:54 +00:00
Jana Radhakrishnan e91ed59cb2 Changed all the naked error returns in bridge driver to proper error
types, except the naked error returns which were just prefixing
strings to previously returned error strings.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-17 02:50:22 +00:00
Jana Radhakrishnan e797f80ad4 Added driver specific config support
- Added api enhancement to pass driver specific config
  - Refactored simple bridge driver code for driver specific config
  - Added an undocumented option to add non-default bridges without
    manual pre-provisioning to help libnetwork testing
  - Reenabled libnetwork test to do api testing
  - Updated README.md

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-15 18:32:07 +00: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
Jana Radhakrishnan 2d364e2c34 - Added support to bridgeNetwork.Link
- Removed MAC and MTU configuration via AddInterface

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2015-04-10 16:45:59 +00:00
Alessandro Boch 68d223a0e0 Issue #18: IP Allocator rework
- Move ipallocator package into libnetwork
- Also ported network utility functions and their tests in libnetwork:
  docker/daemon/networkdriver/utilg.go => libnetwork/utils.go
  docker/daemon/networkdriver/network_test.go => libnetwork/utils_test.go
- Changed drivers/setup_device.go and setup_ipv4.go to reuse functions in
  utils.go, instead of redefining internally.
- Modified utils to use vishvananda/netlink instead of libcontainer/netlink

Signed-off-by: Alessandro Boch <aboch@socketplane.io>
2015-03-24 13:57:59 -07:00
Arnaud Porterie 2457d2549f Fix govet warnings
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-04 14:56:22 -08:00
Arnaud Porterie 6424c7a875 Remove golint warnings
Fix all golint warnings, mostly by making exported types internal.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-04 13:29:28 -08:00
Alessandro Boch e40794cdc4 Fix minor static analysis issue in setup_ipv4.go
Signed-off-by: Alessandro Boch <aboch@socketplane.io>
2015-03-04 11:14:03 -08:00
Arnaud Porterie cb96e4149d Test coverage
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-02-27 09:11:53 -08:00
Arnaud Porterie 3845ec20c4 Test coverage on bridge
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-02-24 18:41:17 -08:00
Arnaud Porterie 8ca185e2ee Move bridge to drivers/
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-02-24 11:29:06 -08:00