mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
don't try to use default route MTU as bridge MTU
Signed-off-by: Patrick Hemmer <patrick.hemmer@gmail.com>
This commit is contained in:
parent
2ecbc9774b
commit
fd9d7c02fc
4 changed files with 1 additions and 30 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue