Revert "Merge pull request #2339 from phyber/iptables-check"
This reverts commit8d76333719
, reversing changes made tobdd0b7bb40
. Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
This commit is contained in:
parent
01f67061b5
commit
f042605a42
1 changed files with 2 additions and 32 deletions
|
@ -2,7 +2,6 @@ package libnetwork
|
|||
|
||||
import (
|
||||
"github.com/docker/libnetwork/iptables"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -10,44 +9,15 @@ const userChain = "DOCKER-USER"
|
|||
|
||||
func (c *controller) arrangeUserFilterRule() {
|
||||
c.Lock()
|
||||
|
||||
if c.hasIPTablesEnabled() {
|
||||
arrangeUserFilterRule()
|
||||
}
|
||||
|
||||
arrangeUserFilterRule()
|
||||
c.Unlock()
|
||||
|
||||
iptables.OnReloaded(func() {
|
||||
c.Lock()
|
||||
|
||||
if c.hasIPTablesEnabled() {
|
||||
arrangeUserFilterRule()
|
||||
}
|
||||
|
||||
arrangeUserFilterRule()
|
||||
c.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
func (c *controller) hasIPTablesEnabled() bool {
|
||||
// Locking c should be handled in the calling method.
|
||||
if c.cfg == nil || c.cfg.Daemon.DriverCfg[netlabel.GenericData] == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
genericData, ok := c.cfg.Daemon.DriverCfg[netlabel.GenericData]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
optMap := genericData.(map[string]interface{})
|
||||
enabled, ok := optMap["EnableIPTables"].(bool)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
return enabled
|
||||
}
|
||||
|
||||
// This chain allow users to configure firewall policies in a way that persists
|
||||
// docker operations/restarts. Docker will not delete or modify any pre-existing
|
||||
// rules from the DOCKER-USER filter chain.
|
||||
|
|
Loading…
Reference in a new issue