Skip to content

Commit

Permalink
don't try to use default route MTU as bridge MTU
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Hemmer <patrick.hemmer@gmail.com>
  • Loading branch information
phemmer committed Dec 7, 2015
1 parent 2ecbc97 commit fd9d7c0
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
4 changes: 0 additions & 4 deletions daemon/container_operations_windows.go
Expand Up @@ -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
}
5 changes: 0 additions & 5 deletions daemon/daemon.go
Expand Up @@ -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) {
Expand Down
20 changes: 0 additions & 20 deletions daemon/daemon_unix.go
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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.
Expand Down

0 comments on commit fd9d7c0

Please sign in to comment.