Merge pull request #191 from dcbw/portmap-panic-fix

portmap: don't panic if listing a chain returns fewer lines than exected
This commit is contained in:
Dan Williams
2018-09-05 10:09:02 -05:00
committed by GitHub

View File

@ -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