From fa2bf4c210c9691db27272a2f81ef0132ac87647 Mon Sep 17 00:00:00 2001 From: Casey Callendrello Date: Wed, 21 Feb 2018 15:35:43 +0100 Subject: [PATCH] vendor: bump go-iptables --- Godeps/Godeps.json | 4 ++-- vendor/github.com/coreos/go-iptables/NOTICE | 5 +++++ .../coreos/go-iptables/iptables/iptables.go | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 vendor/github.com/coreos/go-iptables/NOTICE diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ba217ca6..edd7b8b3 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -47,8 +47,8 @@ }, { "ImportPath": "github.com/coreos/go-iptables/iptables", - "Comment": "v0.2.0", - "Rev": "259c8e6a4275d497442c721fa52204d7a58bde8b" + "Comment": "v0.3.0", + "Rev": "b5b1876b170881a8259f036445ee89c8669db386" }, { "ImportPath": "github.com/coreos/go-systemd/activation", diff --git a/vendor/github.com/coreos/go-iptables/NOTICE b/vendor/github.com/coreos/go-iptables/NOTICE new file mode 100644 index 00000000..23a0ada2 --- /dev/null +++ b/vendor/github.com/coreos/go-iptables/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2018 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-iptables/iptables/iptables.go b/vendor/github.com/coreos/go-iptables/iptables/iptables.go index 1d8b78e2..3d523fc8 100644 --- a/vendor/github.com/coreos/go-iptables/iptables/iptables.go +++ b/vendor/github.com/coreos/go-iptables/iptables/iptables.go @@ -41,6 +41,13 @@ func (e *Error) Error() string { return fmt.Sprintf("running %v: exit status %v: %v", e.cmd.Args, e.ExitStatus(), e.msg) } +// IsNotExist returns true if the error is due to the chain or rule not existing +func (e *Error) IsNotExist() bool { + return e.ExitStatus() == 1 && + (e.msg == "iptables: Bad rule (does a matching rule exist in that chain?).\n" || + e.msg == "iptables: No chain/target/match by that name.\n") +} + // Protocol to differentiate between IPv4 and IPv6 type Protocol byte @@ -289,6 +296,11 @@ func (ipt *IPTables) DeleteChain(table, chain string) error { return ipt.run("-t", table, "-X", chain) } +// ChangePolicy changes policy on chain to target +func (ipt *IPTables) ChangePolicy(table, chain, target string) error { + return ipt.run("-t", table, "-P", chain, target) +} + // run runs an iptables command with the given arguments, ignoring // any stdout output func (ipt *IPTables) run(args ...string) error {