diff --git a/daemon/config/config.go b/daemon/config/config.go index 7bbb759022ba74d7a092a7c92d84691ac62e17a4..aea80755280aa526f18c07a3592a0cac18e1a0dc 100644 --- a/daemon/config/config.go +++ b/daemon/config/config.go @@ -278,7 +278,11 @@ func New() (*Config, error) { MaxConcurrentDownloads: DefaultMaxConcurrentDownloads, MaxConcurrentUploads: DefaultMaxConcurrentUploads, MaxDownloadAttempts: DefaultDownloadAttempts, - BridgeConfig: BridgeConfig{MTU: DefaultNetworkMtu}, + BridgeConfig: BridgeConfig{ + DefaultBridgeConfig: DefaultBridgeConfig{ + MTU: DefaultNetworkMtu, + }, + }, NetworkConfig: NetworkConfig{ NetworkControlPlaneMTU: DefaultNetworkMtu, DefaultNetworkOpts: make(map[string]map[string]string), diff --git a/daemon/config/config_linux.go b/daemon/config/config_linux.go index 749f33d193dba005668a6279de9af15503796ff6..39f2d16610d839c8f71b97089ab7e82d79808f2b 100644 --- a/daemon/config/config_linux.go +++ b/daemon/config/config_linux.go @@ -31,27 +31,31 @@ const ( StockRuntimeName = "runc" ) -// BridgeConfig stores all the bridge driver specific -// configuration. +// BridgeConfig stores all the parameters for both the bridge driver and the default bridge network. type BridgeConfig struct { + DefaultBridgeConfig + + EnableIPTables bool `json:"iptables,omitempty"` + EnableIP6Tables bool `json:"ip6tables,omitempty"` + EnableIPForward bool `json:"ip-forward,omitempty"` + EnableIPMasq bool `json:"ip-masq,omitempty"` + EnableUserlandProxy bool `json:"userland-proxy,omitempty"` + UserlandProxyPath string `json:"userland-proxy-path,omitempty"` +} + +// DefaultBridgeConfig stores all the parameters for the default bridge network. +type DefaultBridgeConfig struct { commonBridgeConfig // Fields below here are platform specific. + EnableIPv6 bool `json:"ipv6,omitempty"` + FixedCIDRv6 string `json:"fixed-cidr-v6,omitempty"` MTU int `json:"mtu,omitempty"` DefaultIP net.IP `json:"ip,omitempty"` IP string `json:"bip,omitempty"` DefaultGatewayIPv4 net.IP `json:"default-gateway,omitempty"` DefaultGatewayIPv6 net.IP `json:"default-gateway-v6,omitempty"` InterContainerCommunication bool `json:"icc,omitempty"` - - EnableIPv6 bool `json:"ipv6,omitempty"` - EnableIPTables bool `json:"iptables,omitempty"` - EnableIP6Tables bool `json:"ip6tables,omitempty"` - EnableIPForward bool `json:"ip-forward,omitempty"` - EnableIPMasq bool `json:"ip-masq,omitempty"` - EnableUserlandProxy bool `json:"userland-proxy,omitempty"` - UserlandProxyPath string `json:"userland-proxy-path,omitempty"` - FixedCIDRv6 string `json:"fixed-cidr-v6,omitempty"` } // Config defines the configuration of a docker daemon. diff --git a/daemon/config/config_test.go b/daemon/config/config_test.go index e85e988c46b5106239598682c56c379b397648c0..0e927c0023e648d7f98f6dedb857ff76f37ec9e3 100644 --- a/daemon/config/config_test.go +++ b/daemon/config/config_test.go @@ -286,7 +286,11 @@ func TestValidateConfigurationErrors(t *testing.T) { name: "negative MTU", config: &Config{ CommonConfig: CommonConfig{ - BridgeConfig: BridgeConfig{MTU: -10}, + BridgeConfig: BridgeConfig{ + DefaultBridgeConfig: DefaultBridgeConfig{ + MTU: -10, + }, + }, }, }, expectedErr: "invalid default MTU: -10", @@ -443,7 +447,11 @@ func TestValidateConfiguration(t *testing.T) { field: "MTU", config: &Config{ CommonConfig: CommonConfig{ - BridgeConfig: BridgeConfig{MTU: 1234}, + BridgeConfig: BridgeConfig{ + DefaultBridgeConfig: DefaultBridgeConfig{ + MTU: 1234, + }, + }, }, }, }, diff --git a/daemon/config/config_windows.go b/daemon/config/config_windows.go index 07b987d4dbd4d9970435b33eead43143fd6e0068..05e185da8851bff4db8f08003fb15ae460469b5e 100644 --- a/daemon/config/config_windows.go +++ b/daemon/config/config_windows.go @@ -15,9 +15,14 @@ const ( StockRuntimeName = "" ) -// BridgeConfig stores all the bridge driver specific -// configuration. +// BridgeConfig is meant to store all the parameters for both the bridge driver and the default bridge network. On +// Windows: 1. "bridge" in this context reference the nat driver and the default nat network; 2. the nat driver has no +// specific parameters, so this struct effectively just stores parameters for the default nat network. type BridgeConfig struct { + DefaultBridgeConfig +} + +type DefaultBridgeConfig struct { commonBridgeConfig // MTU is not actually used on Windows, but the --mtu option has always