mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
7d466c6600
The CreateNetwork in the bridge driver was not able to properly handle concurrent operations causing 2 issues: 1) crash from nil pointer exception 2) not proper handling of conflicting configuration This commit addresses the 2 previous mentioned issues and adds a test for it. The test with the original code has a low failure frequency to confirm the fix I had to add a time.Sleep in the body of the CreateNetwork so to have a 100% failure Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
20 lines
445 B
Go
20 lines
445 B
Go
package bridge
|
|
|
|
import "github.com/docker/libnetwork/iptables"
|
|
|
|
func (n *bridgeNetwork) setupFirewalld(config *networkConfiguration, i *bridgeInterface) error {
|
|
d := n.driver
|
|
d.Lock()
|
|
driverConfig := d.config
|
|
d.Unlock()
|
|
|
|
// Sanity check.
|
|
if !driverConfig.EnableIPTables {
|
|
return IPTableCfgError(config.BridgeName)
|
|
}
|
|
|
|
iptables.OnReloaded(func() { n.setupIPTables(config, i) })
|
|
iptables.OnReloaded(n.portMapper.ReMapAll)
|
|
|
|
return nil
|
|
}
|