Don't clear WEAVE-NPC chain here; it is controlled by weave-npc.

We don't get a very useful error object back from go-iptables and I
didn't feel like parsing the message, so just ignore all errors.
It would be racy to try to check if WEAVE-NPC existed before calling
NewChain.
This commit is contained in:
Bryan Boreham committed 2017-05-18 09:29:33 +00:00
1 parent af246225a9
commit 3cb6569d55
1 file changed
+2 -3
+2 -3
View File
@@ -436,9 +436,8 @@ func configureIPTables(config *BridgeConfig) error {
if config.NPC {
// Steer traffic via the NPC
if err = ipt.ClearChain("filter", "WEAVE-NPC"); err != nil {
return errors.Wrap(err, "clearing WEAVE-NPC chain")
}
_ = ipt.NewChain("filter", "WEAVE-NPC") // ignore error because it might already exist
// If WEAVE-NPC chain doesn't exist then next line will fail
if err = ipt.AppendUnique("filter", "FORWARD", "-o", config.WeaveBridgeName, "-j", "WEAVE-NPC"); err != nil {
return err
}