From 7d329215b0fab6fd3fe16feb38984547f88caf72 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 16 Aug 2018 09:50:28 -0500 Subject: [PATCH] portmap: don't panic if listing a chain returns fewer lines than expected --- plugins/meta/portmap/chain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/meta/portmap/chain.go b/plugins/meta/portmap/chain.go index 5ebfe6a31..e275cb95b 100644 --- a/plugins/meta/portmap/chain.go +++ b/plugins/meta/portmap/chain.go @@ -78,7 +78,7 @@ func (c *chain) teardown(ipt *iptables.IPTables) error { for _, entryChain := range c.entryChains { entryChainRules, err := ipt.List(c.table, entryChain) - if err != nil { + if err != nil || len(entryChainRules) < 1 { // Swallow error here - probably the chain doesn't exist. // If we miss something the deletion will fail continue