Skip to content

Commit

Permalink
fix can not clean the last abandoned snat table (#2701)
Browse files Browse the repository at this point in the history
  • Loading branch information
changluyi committed Apr 24, 2023
1 parent 6ec1982 commit 49dfd39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/daemon/gateway_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (c *Controller) updateIptablesChain(protocol, table, chain, parent string,
added++
}
for i := len(existingRules) - 1; i >= len(rules)-added; i-- {
if err = c.iptables[protocol].Delete(table, chain, strconv.Itoa(i+added)); err != nil {
if err = c.iptables[protocol].Delete(table, chain, strconv.Itoa(i+added+1)); err != nil {
klog.Errorf(`failed to delete iptables rule %v: %v`, existingRules[i], err)
return err
}
Expand Down

0 comments on commit 49dfd39

Please sign in to comment.