diff --git a/libnetwork/config/config.go b/libnetwork/config/config.go index 96a157a1fb..3e8473d255 100644 --- a/libnetwork/config/config.go +++ b/libnetwork/config/config.go @@ -15,6 +15,11 @@ import ( "github.com/sirupsen/logrus" ) +const ( + warningThNetworkControlPlaneMTU = 1500 + minimumNetworkControlPlaneMTU = 500 +) + // Config encapsulates configurations of various Libnetwork components type Config struct { Daemon DaemonCfg @@ -226,9 +231,12 @@ func OptionExperimental(exp bool) Option { func OptionNetworkControlPlaneMTU(exp int) Option { return func(c *Config) { logrus.Debugf("Network Control Plane MTU: %d", exp) - if exp < 1500 { - // if exp == 0 the value won't be used - logrus.Warnf("Received a MTU of %d, this value is very low, the network control plane can misbehave", exp) + if exp < warningThNetworkControlPlaneMTU { + logrus.Warnf("Received a MTU of %d, this value is very low, the network control plane can misbehave,"+ + " defaulting to minimum value (%d)", exp, minimumNetworkControlPlaneMTU) + if exp < minimumNetworkControlPlaneMTU { + exp = minimumNetworkControlPlaneMTU + } } c.Daemon.NetworkControlPlaneMTU = exp }