1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #42726 from thaJeztah/daemon_simplify_nwconfig

daemon: simplify networking config
This commit is contained in:
Akihiro Suda 2021-11-12 01:19:07 +09:00 committed by GitHub
commit d116e12c6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View file

@ -1450,7 +1450,7 @@ func (daemon *Daemon) networkOptions(dconfig *config.Config, pg plugingetter.Plu
}
options = append(options, nwconfig.OptionLabels(dconfig.Labels))
options = append(options, driverOptions(dconfig)...)
options = append(options, driverOptions(dconfig))
if len(dconfig.NetworkConfig.DefaultAddressPools.Value()) > 0 {
options = append(options, nwconfig.OptionDefaultAddressPoolConfig(dconfig.NetworkConfig.DefaultAddressPools.Value()))

View file

@ -921,18 +921,16 @@ func (daemon *Daemon) initNetworkController(config *config.Config, activeSandbox
return controller, nil
}
func driverOptions(config *config.Config) []nwconfig.Option {
bridgeConfig := options.Generic{
"EnableIPForwarding": config.BridgeConfig.EnableIPForward,
"EnableIPTables": config.BridgeConfig.EnableIPTables,
"EnableIP6Tables": config.BridgeConfig.EnableIP6Tables,
"EnableUserlandProxy": config.BridgeConfig.EnableUserlandProxy,
"UserlandProxyPath": config.BridgeConfig.UserlandProxyPath}
bridgeOption := options.Generic{netlabel.GenericData: bridgeConfig}
dOptions := []nwconfig.Option{}
dOptions = append(dOptions, nwconfig.OptionDriverConfig("bridge", bridgeOption))
return dOptions
func driverOptions(config *config.Config) nwconfig.Option {
return nwconfig.OptionDriverConfig("bridge", options.Generic{
netlabel.GenericData: options.Generic{
"EnableIPForwarding": config.BridgeConfig.EnableIPForward,
"EnableIPTables": config.BridgeConfig.EnableIPTables,
"EnableIP6Tables": config.BridgeConfig.EnableIP6Tables,
"EnableUserlandProxy": config.BridgeConfig.EnableUserlandProxy,
"UserlandProxyPath": config.BridgeConfig.UserlandProxyPath,
},
})
}
func initBridgeDriver(controller libnetwork.NetworkController, config *config.Config) error {

View file

@ -522,8 +522,8 @@ func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container
return daemon.Unmount(container)
}
func driverOptions(config *config.Config) []nwconfig.Option {
return []nwconfig.Option{}
func driverOptions(_ *config.Config) nwconfig.Option {
return nil
}
func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {