Skip to content

Commit 5e34060

Browse files
committed
controller: Check if IPTables is enabled for arrangeUserFilterRule
This allows the `--iptables=false` argument to the `dockerd` to actually work. Signed-off-by: David O'Rourke <david@scalefactory.com>
1 parent 9ff9b57 commit 5e34060

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

controller.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
682705
func (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
}

0 commit comments

Comments
 (0)