Skip to content

Commit 49dfd39

Browse files
authored
fix can not clean the last abandoned snat table (#2701)
1 parent 6ec1982 commit 49dfd39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/daemon/gateway_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func (c *Controller) updateIptablesChain(protocol, table, chain, parent string,
378378
added++
379379
}
380380
for i := len(existingRules) - 1; i >= len(rules)-added; i-- {
381-
if err = c.iptables[protocol].Delete(table, chain, strconv.Itoa(i+added)); err != nil {
381+
if err = c.iptables[protocol].Delete(table, chain, strconv.Itoa(i+added+1)); err != nil {
382382
klog.Errorf(`failed to delete iptables rule %v: %v`, existingRules[i], err)
383383
return err
384384
}

0 commit comments

Comments
 (0)