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:
commit
94791877ee
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
package bridge
|
||||
|
||||
import (
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"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
|
||||
// was not supported before that.
|
||||
kv, err := kernel.GetKernelVersion()
|
||||
if err == nil && (kv.Kernel >= 3 && kv.Major >= 3) {
|
||||
setMac = true
|
||||
if err != nil {
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue