]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daf: fix del method
authorrealPy <t3sla@v-ip.fr>
Mon, 30 Mar 2020 10:54:22 +0000 (12:54 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 2 Apr 2020 11:57:31 +0000 (13:57 +0200)
The id rule is not the same as the index of the array.

Fixes: #553
modules/daf/daf.lua

index 0786d6d681ec059d781864d35bdf2dd8f6a3bb52..59f7ba8a85aa8ebe4a44e631154f295366f45b5c 100644 (file)
@@ -176,10 +176,10 @@ end
 
 -- @function Remove a rule
 function M.del(id)
-       for _, r in ipairs(M.rules) do
+       for key, r in ipairs(M.rules) do
                if r.rule.id == id then
                        policy.del(id)
-                       table.remove(M.rules, id)
+                       table.remove(M.rules, key)
                        return true
                end
        end