From: Michael Kuron Date: Sun, 16 Jul 2017 13:19:59 +0000 (+0200) Subject: Minimum netmask in Redis multimap X-Git-Tag: 1.6.3~2^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1761%2Fhead;p=rspamd.git Minimum netmask in Redis multimap --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index ea3508a60..ca32a8d21 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -383,11 +383,13 @@ local function multimap_callback(task, rule) (r['filter'] == 'real_ip' or r['filter'] == 'from_ip' or not r['filter'])) then srch = {value:to_string()} cmd = 'HMGET' - local bits = 128 + local maxbits = 128 + local minbits = 32 if value:get_version() == 4 then - bits = 32 + maxbits = 32 + minbits = 8 end - for i=bits,1,-1 do + for i=maxbits,minbits,-1 do local nip = value:apply_mask(i):to_string() .. "/" .. i table.insert(srch, nip) end