Browse Source

Merge pull request #301 from mavenugo/master

Cleaning up iptables nat table on driver bootup
Jana Radhakrishnan 10 years ago
parent
commit
21f8bda64e
1 changed files with 5 additions and 0 deletions
  1. 5 0
      libnetwork/drivers/bridge/bridge.go

+ 5 - 0
libnetwork/drivers/bridge/bridge.go

@@ -10,6 +10,7 @@ import (
 	"github.com/Sirupsen/logrus"
 	"github.com/docker/libnetwork/driverapi"
 	"github.com/docker/libnetwork/ipallocator"
+	"github.com/docker/libnetwork/iptables"
 	"github.com/docker/libnetwork/netlabel"
 	"github.com/docker/libnetwork/netutils"
 	"github.com/docker/libnetwork/options"
@@ -110,6 +111,10 @@ func Init(dc driverapi.DriverCallback) error {
 	if out, err := exec.Command("modprobe", "-va", "bridge", "nf_nat", "br_netfilter").Output(); err != nil {
 		logrus.Warnf("Running modprobe bridge nf_nat failed with message: %s, error: %v", out, err)
 	}
+	if err := iptables.RemoveExistingChain(DockerChain, iptables.Nat); err != nil {
+		logrus.Warnf("Failed to remove existing iptables entries in %s : %v", DockerChain, err)
+	}
+
 	c := driverapi.Capability{
 		Scope: driverapi.LocalScope,
 	}