mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Configure iptables forward policy when ip forwarding is enabled
Signed-off-by: Leonardo Nodari <me@leonardonodari.it>
This commit is contained in:
parent
b8f02469bc
commit
7e584c1d69
1 changed files with 5 additions and 5 deletions
|
@ -34,11 +34,11 @@ func setupIPForwarding(enableIPTables bool) error {
|
||||||
if err := configureIPForwarding(true); err != nil {
|
if err := configureIPForwarding(true); err != nil {
|
||||||
return fmt.Errorf("Enabling IP forwarding failed: %v", err)
|
return fmt.Errorf("Enabling IP forwarding failed: %v", err)
|
||||||
}
|
}
|
||||||
// When enabling ip_forward set the default policy on forward chain to
|
}
|
||||||
// drop only if the daemon option iptables is not set to false.
|
|
||||||
if !enableIPTables {
|
// Set the default policy on forward chain to drop only if the
|
||||||
return nil
|
// daemon option iptables is not set to false.
|
||||||
}
|
if enableIPTables {
|
||||||
if err := iptables.SetDefaultPolicy(iptables.Filter, "FORWARD", iptables.Drop); err != nil {
|
if err := iptables.SetDefaultPolicy(iptables.Filter, "FORWARD", iptables.Drop); err != nil {
|
||||||
if err := configureIPForwarding(false); err != nil {
|
if err := configureIPForwarding(false); err != nil {
|
||||||
logrus.Errorf("Disabling IP forwarding failed, %v", err)
|
logrus.Errorf("Disabling IP forwarding failed, %v", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue