Skip to content

Commit

Permalink
Configure iptables forward policy when ip forwarding is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Nodari <me@leonardonodari.it>
  • Loading branch information
TheNodi committed Sep 12, 2019
1 parent 92d1fbe commit d070217
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/bridge/setup_ip_forwarding.go
Expand Up @@ -34,11 +34,11 @@ func setupIPForwarding(enableIPTables bool) error {
if err := configureIPForwarding(true); err != nil {
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 {
return nil
}
}

// Set the default policy on forward chain to drop only if the
// daemon option iptables is not set to false.
if enableIPTables {
if err := iptables.SetDefaultPolicy(iptables.Filter, "FORWARD", iptables.Drop); err != nil {
if err := configureIPForwarding(false); err != nil {
logrus.Errorf("Disabling IP forwarding failed, %v", err)
Expand Down

0 comments on commit d070217

Please sign in to comment.