From 1b370f9d8dbd1c476db766e8587617e795570d97 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 4 Apr 2013 05:33:28 -0700 Subject: [PATCH] Move the default bridge name to a constant --- docker/docker.go | 2 +- network.go | 5 +++-- runtime.go | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docker/docker.go b/docker/docker.go index 85bfc8e551..d38d67216c 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -27,7 +27,7 @@ func main() { if *bridgeName != "" { docker.NetworkBridgeIface = *bridgeName } else { - docker.NetworkBridgeIface = "lxcbr0" + docker.NetworkBridgeIface = docker.DefaultNetworkBridge } if *flDebug { os.Setenv("DEBUG", "1") diff --git a/network.go b/network.go index cde78e7aa6..105c0056f5 100644 --- a/network.go +++ b/network.go @@ -14,8 +14,9 @@ import ( var NetworkBridgeIface string const ( - portRangeStart = 49153 - portRangeEnd = 65535 + DefaultNetworkBridge = "lxcbr0" + portRangeStart = 49153 + portRangeEnd = 65535 ) // Calculates the first and last IP addresses in an IPNet diff --git a/runtime.go b/runtime.go index 97752a2ab5..0e5bcbfc69 100644 --- a/runtime.go +++ b/runtime.go @@ -267,6 +267,9 @@ func NewRuntimeFromDirectory(root string) (*Runtime, error) { if err != nil { return nil, fmt.Errorf("Couldn't create Tag store: %s", err) } + if NetworkBridgeIface == "" { + NetworkBridgeIface = DefaultNetworkBridge + } netManager, err := newNetworkManager(NetworkBridgeIface) if err != nil { return nil, err