1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #421 from aboch/kn

Incorrect kernel version check in bridge
This commit is contained in:
Madhu Venugopal 2015-07-30 08:15:02 -07:00
commit 94791877ee

View file

@ -1,6 +1,7 @@
package bridge package bridge
import ( import (
"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
"github.com/vishvananda/netlink" "github.com/vishvananda/netlink"
) )
@ -25,8 +26,10 @@ func setupDevice(config *networkConfiguration, i *bridgeInterface) error {
// Only set the bridge's MAC address if the kernel version is > 3.3, as it // Only set the bridge's MAC address if the kernel version is > 3.3, as it
// was not supported before that. // was not supported before that.
kv, err := kernel.GetKernelVersion() kv, err := kernel.GetKernelVersion()
if err == nil && (kv.Kernel >= 3 && kv.Major >= 3) { if err != nil {
setMac = true logrus.Errorf("Failed to check kernel versions: %v. Will not assign a MAC address to the bridge interface", err)
} else {
setMac = kv.Kernel > 3 || (kv.Kernel == 3 && kv.Major >= 3)
} }
return ioctlCreateBridge(config.BridgeName, setMac) return ioctlCreateBridge(config.BridgeName, setMac)