Merge pull request #45657 from corhere/libn/setup-resolver-with-verbose-iptables
libnetwork: fix resolver restore w/ chatty 'iptables -C'
This commit is contained in:
commit
d43b398746
1 changed files with 2 additions and 4 deletions
|
@ -37,8 +37,7 @@ func (r *Resolver) setupIPTable() error {
|
|||
iptable := iptables.GetIptable(iptables.IPv4)
|
||||
|
||||
// insert outputChain and postroutingchain
|
||||
err := iptable.RawCombinedOutputNative("-t", "nat", "-C", "OUTPUT", "-d", resolverIP, "-j", outputChain)
|
||||
if err == nil {
|
||||
if iptable.ExistsNative("nat", "OUTPUT", "-d", resolverIP, "-j", outputChain) {
|
||||
if err := iptable.RawCombinedOutputNative("-t", "nat", "-F", outputChain); err != nil {
|
||||
setupErr = err
|
||||
return
|
||||
|
@ -54,8 +53,7 @@ func (r *Resolver) setupIPTable() error {
|
|||
}
|
||||
}
|
||||
|
||||
err = iptable.RawCombinedOutputNative("-t", "nat", "-C", "POSTROUTING", "-d", resolverIP, "-j", postroutingChain)
|
||||
if err == nil {
|
||||
if iptable.ExistsNative("nat", "POSTROUTING", "-d", resolverIP, "-j", postroutingChain) {
|
||||
if err := iptable.RawCombinedOutputNative("-t", "nat", "-F", postroutingChain); err != nil {
|
||||
setupErr = err
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue