Fix windows cross compile with new netlink
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
189d2c7985
commit
7d8b5fc3aa
|
@ -183,3 +183,7 @@ func (container *Container) unmountIpcMounts() error {
|
||||||
func (container *Container) ipcMounts() []execdriver.Mount {
|
func (container *Container) ipcMounts() []execdriver.Mount {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDefaultRouteMtu() (int, error) {
|
||||||
|
return -1, errSystemNotSupported
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
@ -53,7 +52,6 @@ import (
|
||||||
"github.com/docker/docker/volume/local"
|
"github.com/docker/docker/volume/local"
|
||||||
"github.com/docker/docker/volume/store"
|
"github.com/docker/docker/volume/store"
|
||||||
"github.com/docker/libnetwork"
|
"github.com/docker/libnetwork"
|
||||||
"github.com/vishvananda/netlink"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1077,25 +1075,6 @@ func setDefaultMtu(config *Config) {
|
||||||
|
|
||||||
var errNoDefaultRoute = errors.New("no default route was found")
|
var errNoDefaultRoute = errors.New("no default route was found")
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|
||||||
// verifyContainerSettings performs validation of the hostconfig and config
|
// verifyContainerSettings performs validation of the hostconfig and config
|
||||||
// structures.
|
// structures.
|
||||||
func (daemon *Daemon) verifyContainerSettings(ctx context.Context, hostConfig *runconfig.HostConfig, config *runconfig.Config) ([]string, error) {
|
func (daemon *Daemon) verifyContainerSettings(ctx context.Context, hostConfig *runconfig.HostConfig, config *runconfig.Config) ([]string, error) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import (
|
||||||
"github.com/docker/libnetwork/netlabel"
|
"github.com/docker/libnetwork/netlabel"
|
||||||
"github.com/docker/libnetwork/options"
|
"github.com/docker/libnetwork/options"
|
||||||
"github.com/opencontainers/runc/libcontainer/label"
|
"github.com/opencontainers/runc/libcontainer/label"
|
||||||
|
"github.com/vishvananda/netlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -554,3 +555,22 @@ func (daemon *Daemon) newBaseContainer(id string) Container {
|
||||||
VolumesRW: make(map[string]bool),
|
VolumesRW: make(map[string]bool),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue