Quellcode durchsuchen

Merge pull request #211 from mavenugo/bn

WIP : default configs for new network in bridge driver
Jana Radhakrishnan vor 10 Jahren
Ursprung
Commit
fa480bd82a
2 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen
  1. 1 1
      libnetwork/client/network.go
  2. 8 4
      libnetwork/drivers/bridge/bridge.go

+ 1 - 1
libnetwork/client/network.go

@@ -45,7 +45,7 @@ func (cli *NetworkCli) CmdNetwork(chain string, args ...string) error {
 // CmdNetworkCreate handles Network Create UI
 func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error {
 	cmd := cli.Subcmd(chain, "create", "NETWORK-NAME", "Creates a new network with a name specified by the user", false)
-	flDriver := cmd.String([]string{"d", "-driver"}, "null", "Driver to manage the Network")
+	flDriver := cmd.String([]string{"d", "-driver"}, "bridge", "Driver to manage the Network")
 	cmd.Require(flag.Min, 1)
 	err := cmd.ParseFlags(args, true)
 	if err != nil {

+ 8 - 4
libnetwork/drivers/bridge/bridge.go

@@ -175,8 +175,8 @@ func (c *networkConfiguration) Conflict(o *networkConfiguration) bool {
 	return false
 }
 
-// FromMap retrieve the configuration data from the map form.
-func (c *networkConfiguration) FromMap(data map[string]interface{}) error {
+// fromMap retrieve the configuration data from the map form.
+func (c *networkConfiguration) fromMap(data map[string]interface{}) error {
 	var err error
 
 	if i, ok := data["BridgeName"]; ok && i != nil {
@@ -393,8 +393,12 @@ func parseNetworkGenericOptions(data interface{}) (*networkConfiguration, error)
 	case *networkConfiguration:
 		config = opt
 	case map[string]interface{}:
-		config = &networkConfiguration{}
-		err = config.FromMap(opt)
+		config = &networkConfiguration{
+			EnableICC:          true,
+			EnableIPTables:     true,
+			EnableIPMasquerade: true,
+		}
+		err = config.fromMap(opt)
 	case options.Generic:
 		var opaqueConfig interface{}
 		if opaqueConfig, err = options.GenerateFromModel(opt, config); err == nil {