2021-08-23 09:14:53 -04:00
|
|
|
//go:build linux
|
2021-05-25 19:48:54 -04:00
|
|
|
// +build linux
|
|
|
|
|
2015-07-24 13:20:48 -04:00
|
|
|
package bridge
|
|
|
|
|
2021-04-05 20:24:47 -04:00
|
|
|
import "github.com/docker/docker/libnetwork/iptables"
|
2015-07-24 13:20:48 -04:00
|
|
|
|
|
|
|
func (n *bridgeNetwork) setupFirewalld(config *networkConfiguration, i *bridgeInterface) error {
|
2015-06-11 21:12:00 -04:00
|
|
|
d := n.driver
|
|
|
|
d.Lock()
|
|
|
|
driverConfig := d.config
|
|
|
|
d.Unlock()
|
|
|
|
|
2015-07-24 13:20:48 -04:00
|
|
|
// Sanity check.
|
2017-09-08 17:48:03 -04:00
|
|
|
if !driverConfig.EnableIPTables {
|
2015-07-24 13:20:48 -04:00
|
|
|
return IPTableCfgError(config.BridgeName)
|
|
|
|
}
|
|
|
|
|
2020-07-21 10:40:18 -04:00
|
|
|
iptables.OnReloaded(func() { n.setupIP4Tables(config, i) })
|
2015-07-24 13:20:48 -04:00
|
|
|
iptables.OnReloaded(n.portMapper.ReMapAll)
|
2020-07-21 10:40:18 -04:00
|
|
|
return nil
|
|
|
|
}
|
2015-07-24 13:20:48 -04:00
|
|
|
|
2020-07-21 10:40:18 -04:00
|
|
|
func (n *bridgeNetwork) setupFirewalld6(config *networkConfiguration, i *bridgeInterface) error {
|
|
|
|
d := n.driver
|
|
|
|
d.Lock()
|
|
|
|
driverConfig := d.config
|
|
|
|
d.Unlock()
|
|
|
|
|
|
|
|
// Sanity check.
|
|
|
|
if !driverConfig.EnableIP6Tables {
|
|
|
|
return IPTableCfgError(config.BridgeName)
|
2017-11-28 16:15:55 -05:00
|
|
|
}
|
|
|
|
|
2020-07-21 10:40:18 -04:00
|
|
|
iptables.OnReloaded(func() { n.setupIP6Tables(config, i) })
|
|
|
|
iptables.OnReloaded(n.portMapperV6.ReMapAll)
|
2015-07-24 13:20:48 -04:00
|
|
|
return nil
|
|
|
|
}
|