浏览代码

Merge pull request #8612 from jfrazelle/8611-ip-masq-iptables

Setting iptables=false should propagate to ip-masq=false
Michael Crosby 10 年之前
父节点
当前提交
d1aca045b3
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 1 1
      daemon/daemon.go
  2. 10 0
      integration-cli/docker_cli_daemon_test.go

+ 1 - 1
daemon/daemon.go

@@ -731,7 +731,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
 		return nil, fmt.Errorf("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.")
 		return nil, fmt.Errorf("You specified --iptables=false with --icc=false. ICC uses iptables to function. Please set --icc or --iptables to true.")
 	}
 	}
 	if !config.EnableIptables && config.EnableIpMasq {
 	if !config.EnableIptables && config.EnableIpMasq {
-		return nil, fmt.Errorf("You specified --iptables=false with --ipmasq=true. IP masquerading uses iptables to function. Please set --ipmasq to false or --iptables to true.")
+		config.EnableIpMasq = false
 	}
 	}
 	config.DisableNetwork = config.BridgeIface == disableNetworkBridge
 	config.DisableNetwork = config.BridgeIface == disableNetworkBridge
 
 

+ 10 - 0
integration-cli/docker_cli_daemon_test.go

@@ -82,3 +82,13 @@ func TestDaemonRestartWithVolumesRefs(t *testing.T) {
 
 
 	logDone("daemon - volume refs are restored")
 	logDone("daemon - volume refs are restored")
 }
 }
+
+func TestDaemonStartIptablesFalse(t *testing.T) {
+	d := NewDaemon(t)
+	if err := d.Start("--iptables=false"); err != nil {
+		t.Fatalf("we should have been able to start the daemon with passing iptables=false: %v", err)
+	}
+	d.Stop()
+
+	logDone("daemon - started daemon with iptables=false")
+}