@@ -67,8 +67,8 @@ type NetworkManager struct {
6767// NewNetworkManager creates a brand new network manager.
6868func NewNetworkManager (cfg * config.Config , store * meta.Store , ctrMgr ContainerMgr ) (* NetworkManager , error ) {
6969 // Create a new controller instance
70- cfg .NetworkConfg .MetaPath = path .Dir (store .BaseDir )
71- cfg .NetworkConfg .ExecRoot = network .DefaultExecRoot
70+ cfg .NetworkConfig .MetaPath = path .Dir (store .BaseDir )
71+ cfg .NetworkConfig .ExecRoot = network .DefaultExecRoot
7272
7373 initNetworkLog (cfg )
7474
@@ -81,17 +81,17 @@ func NewNetworkManager(cfg *config.Config, store *meta.Store, ctrMgr ContainerMg
8181 logrus .Errorf ("failed to new network manager, can not get container list" )
8282 return nil , errors .Wrap (err , "failed to get container list" )
8383 }
84- cfg .NetworkConfg .ActiveSandboxes = make (map [string ]interface {})
84+ cfg .NetworkConfig .ActiveSandboxes = make (map [string ]interface {})
8585 for _ , c := range ctrs {
8686 endpoint := BuildContainerEndpoint (c )
87- sbOptions , err := buildSandboxOptions (cfg .NetworkConfg , endpoint )
87+ sbOptions , err := buildSandboxOptions (cfg .NetworkConfig , endpoint )
8888 if err != nil {
8989 return nil , errors .Wrap (err , "failed to build sandbox options" )
9090 }
91- cfg .NetworkConfg .ActiveSandboxes [c .NetworkSettings .SandboxID ] = sbOptions
91+ cfg .NetworkConfig .ActiveSandboxes [c .NetworkSettings .SandboxID ] = sbOptions
9292 }
9393
94- ctlOptions , err := controllerOptions (cfg .NetworkConfg )
94+ ctlOptions , err := controllerOptions (cfg .NetworkConfig )
9595 if err != nil {
9696 return nil , errors .Wrap (err , "failed to build network options" )
9797 }
@@ -104,7 +104,7 @@ func NewNetworkManager(cfg *config.Config, store *meta.Store, ctrMgr ContainerMg
104104 return & NetworkManager {
105105 store : store ,
106106 controller : controller ,
107- config : cfg .NetworkConfg ,
107+ config : cfg .NetworkConfig ,
108108 }, nil
109109}
110110
@@ -449,16 +449,16 @@ func controllerOptions(cfg network.Config) ([]nwconfig.Option, error) {
449449 options = append (options , nwconfig .OptionDefaultNetwork ("bridge" ))
450450
451451 // set bridge options
452- options = append (options , bridgeDriverOptions ())
452+ options = append (options , bridgeDriverOptions (cfg . BridgeConfig ))
453453
454454 return options , nil
455455}
456456
457- func bridgeDriverOptions () nwconfig.Option {
457+ func bridgeDriverOptions (cfg network. BridgeConfig ) nwconfig.Option {
458458 bridgeConfig := options.Generic {
459- "EnableIPForwarding" : true ,
460- "EnableIPTables" : true ,
461- "EnableUserlandProxy" : true }
459+ "EnableIPForwarding" : cfg . IPForward ,
460+ "EnableIPTables" : cfg . IPTables ,
461+ "EnableUserlandProxy" : cfg . UserlandProxy }
462462 bridgeOption := options.Generic {netlabel .GenericData : bridgeConfig }
463463
464464 return nwconfig .OptionDriverConfig ("bridge" , bridgeOption )
0 commit comments