File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -679,6 +679,29 @@ func (c *controller) isAgent() bool {
679679 return c .cfg .Daemon .ClusterProvider .IsAgent ()
680680}
681681
682+ func (c * controller ) hasIPTablesEnabled () bool {
683+ c .Lock ()
684+ defer c .Unlock ()
685+
686+ if c .cfg == nil || c .cfg .Daemon .DriverCfg [netlabel .GenericData ] == nil {
687+ return false
688+ }
689+
690+ genericData , ok := c .cfg .Daemon .DriverCfg [netlabel .GenericData ]
691+ if ! ok {
692+ return false
693+ }
694+
695+ optMap := genericData .(map [string ]interface {})
696+
697+ enabled , ok := optMap ["EnableIPTables" ].(bool )
698+ if ! ok {
699+ return false
700+ }
701+
702+ return enabled
703+ }
704+
682705func (c * controller ) isDistributedControl () bool {
683706 return ! c .isManager () && ! c .isAgent ()
684707}
@@ -902,7 +925,9 @@ addToStore:
902925 c .Unlock ()
903926 }
904927
905- c .arrangeUserFilterRule ()
928+ if c .hasIPTablesEnabled () {
929+ c .arrangeUserFilterRule ()
930+ }
906931
907932 return network , nil
908933}
You can’t perform that action at this time.
0 commit comments