Browse code

docker/config: update -mtu flag default

Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: google)

Johan Euphrosine authored on 2014/02/04 08:36:39
Showing 3 changed files
... ...
@@ -49,7 +49,7 @@ func DaemonConfigFromJob(job *engine.Job) *DaemonConfig {
49 49
 	if mtu := job.GetenvInt("Mtu"); mtu != 0 {
50 50
 		config.Mtu = mtu
51 51
 	} else {
52
-		config.Mtu = DefaultNetworkMtu
52
+		config.Mtu = GetDefaultNetworkMtu()
53 53
 	}
54 54
 	config.DisableNetwork = job.Getenv("BridgeIface") == DisableNetworkBridge
55 55
 
... ...
@@ -43,7 +43,7 @@ func main() {
43 43
 		flInterContainerComm = flag.Bool([]string{"#icc", "-icc"}, true, "Enable inter-container communication")
44 44
 		flGraphDriver        = flag.String([]string{"s", "-storage-driver"}, "", "Force the docker runtime to use a specific storage driver")
45 45
 		flHosts              = docker.NewListOpts(docker.ValidateHost)
46
-		flMtu                = flag.Int([]string{"#mtu", "-mtu"}, docker.GetDefaultNetworkMtu(), "Set the containers network mtu")
46
+		flMtu                = flag.Int([]string{"#mtu", "-mtu"}, 0, "Set the containers network MTU; if no value is provided: default to the default route MTU or 1500 if not default route is available")
47 47
 	)
48 48
 	flag.Var(&flDns, []string{"#dns", "-dns"}, "Force docker to use specific DNS servers")
49 49
 	flag.Var(&flHosts, []string{"H", "-host"}, "tcp://host:port, unix://path/to/socket, fd://* or fd://socketfd to use in daemon mode. Multiple sockets can be specified")
... ...
@@ -4,9 +4,6 @@ import (
4 4
 	"archive/tar"
5 5
 	"bytes"
6 6
 	"fmt"
7
-	"github.com/dotcloud/docker"
8
-	"github.com/dotcloud/docker/engine"
9
-	"github.com/dotcloud/docker/utils"
10 7
 	"io"
11 8
 	"io/ioutil"
12 9
 	"net/http"
... ...
@@ -16,6 +13,10 @@ import (
16 16
 	"strings"
17 17
 	"testing"
18 18
 	"time"
19
+
20
+	"github.com/dotcloud/docker"
21
+	"github.com/dotcloud/docker/engine"
22
+	"github.com/dotcloud/docker/utils"
19 23
 )
20 24
 
21 25
 // This file contains utility functions for docker's unit test suite.
... ...
@@ -32,7 +33,7 @@ func mkRuntime(f utils.Fataler) *docker.Runtime {
32 32
 	config := &docker.DaemonConfig{
33 33
 		Root:        root,
34 34
 		AutoRestart: false,
35
-		Mtu:         docker.DefaultNetworkMtu,
35
+		Mtu:         docker.GetDefaultNetworkMtu(),
36 36
 	}
37 37
 
38 38
 	eng, err := engine.New(root)