From fd9d7c02fcc8edd73d056f56f17e5cfe1760495b Mon Sep 17 00:00:00 2001 From: Patrick Hemmer Date: Thu, 19 Nov 2015 20:14:35 -0500 Subject: [PATCH] don't try to use default route MTU as bridge MTU Signed-off-by: Patrick Hemmer --- daemon/container_operations_windows.go | 4 ---- daemon/daemon.go | 5 ----- daemon/daemon_unix.go | 20 ------------------- .../default_network/custom-docker0.md | 2 +- 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/daemon/container_operations_windows.go b/daemon/container_operations_windows.go index 4198c250b1..e25866b4ca 100644 --- a/daemon/container_operations_windows.go +++ b/daemon/container_operations_windows.go @@ -162,10 +162,6 @@ func detachMounted(path string) error { return nil } -func getDefaultRouteMtu() (int, error) { - return -1, errSystemNotSupported -} - func killProcessDirectly(container *container.Container) error { return nil } diff --git a/daemon/daemon.go b/daemon/daemon.go index ade08aab0c..441e20c166 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -1382,13 +1382,8 @@ func setDefaultMtu(config *Config) { return } config.Mtu = defaultNetworkMtu - if routeMtu, err := getDefaultRouteMtu(); err == nil { - config.Mtu = routeMtu - } } -var errNoDefaultRoute = errors.New("no default route was found") - // verifyContainerSettings performs validation of the hostconfig and config // structures. func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig, config *runconfig.Config) ([]string, error) { diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index fbb7fb2d9e..1cceaa4e7e 100755 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -33,7 +33,6 @@ import ( "github.com/docker/libnetwork/types" blkiodev "github.com/opencontainers/runc/libcontainer/configs" "github.com/opencontainers/runc/libcontainer/label" - "github.com/vishvananda/netlink" ) const ( @@ -670,25 +669,6 @@ func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container daemon.Unmount(container) } -// getDefaultRouteMtu returns the MTU for the default route's interface. -func getDefaultRouteMtu() (int, error) { - routes, err := netlink.RouteList(nil, 0) - if err != nil { - return 0, err - } - for _, r := range routes { - // a nil Dst means that this is the default route. - if r.Dst == nil { - i, err := net.InterfaceByIndex(r.LinkIndex) - if err != nil { - continue - } - return i.MTU, nil - } - } - return 0, errNoDefaultRoute -} - func restoreCustomImage(driver graphdriver.Driver, is image.Store, ls layer.Store, ts tag.Store) error { // Unix has no custom images to register return nil diff --git a/docs/userguide/networking/default_network/custom-docker0.md b/docs/userguide/networking/default_network/custom-docker0.md index 494da6dec7..e9334f4c25 100644 --- a/docs/userguide/networking/default_network/custom-docker0.md +++ b/docs/userguide/networking/default_network/custom-docker0.md @@ -16,7 +16,7 @@ The information in this section explains how to customize the Docker default bri By default, the Docker server creates and configures the host system's `docker0` interface as an _Ethernet bridge_ inside the Linux kernel that can pass packets back and forth between other physical or virtual network interfaces so that they behave as a single Ethernet network. -Docker configures `docker0` with an IP address, netmask and IP allocation range. The host machine can both receive and send packets to containers connected to the bridge, and gives it an MTU -- the _maximum transmission unit_ or largest packet length that the interface will allow -- of either 1,500 bytes or else a more specific value copied from the Docker host's interface that supports its default route. These options are configurable at server startup: +Docker configures `docker0` with an IP address, netmask and IP allocation range. The host machine can both receive and send packets to containers connected to the bridge, and gives it an MTU -- the _maximum transmission unit_ or largest packet length that the interface will allow -- of 1,500 bytes. These options are configurable at server startup: - `--bip=CIDR` -- supply a specific IP address and netmask for the `docker0` bridge, using standard CIDR notation like `192.168.1.5/24`. - `--fixed-cidr=CIDR` -- restrict the IP range from the `docker0` subnet, using the standard CIDR notation like `172.167.1.0/28`. This range must be an IPv4 range for fixed IPs (ex: 10.20.0.0/16) and must be a subset of the bridge IP range (`docker0` or set using `--bridge`). For example with `--fixed-cidr=192.168.1.0/25`, IPs for your containers will be chosen from the first half of `192.168.1.0/24` subnet.