aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2015-08-28 17:57:38 +0200
committerAndrew Lewis <nerf@judo.za.org>2015-09-02 14:10:00 +0200
commitffdf614e84e2548f9e21aa62b0300b0e91e4807d (patch)
treeaf512df75c3bc6c3977f6b3501dde0c6698f537f /src/plugins
parent03f0bcb32e1006d595c59c5ff823aeae79a8c11a (diff)
downloadrspamd-ffdf614e84e2548f9e21aa62b0300b0e91e4807d.tar.gz
rspamd-ffdf614e84e2548f9e21aa62b0300b0e91e4807d.zip
Log neutral scores too
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/ip_score.lua34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua
index f9f768389..67d7ece1b 100644
--- a/src/plugins/lua/ip_score.lua
+++ b/src/plugins/lua/ip_score.lua
@@ -168,7 +168,7 @@ local ip_score_set = function(task)
local asn_score,total_asn,
country_score,total_country,
ipnet_score,total_ipnet,
- ip_score, total_ip = pool:get_variable('ip_score',
+ ip_score, total_ip = pool:get_variable('ip_score',
'double,double,double,double,double,double,double,double')
local score_mult = 0
@@ -182,23 +182,21 @@ local ip_score_set = function(task)
score = score_mult * rspamd_util.tanh (2.718 * score)
- if score ~= 0 then
- local hkey = ip_score_hash_key(asn, country, ipnet, ip)
- local upstream = upstreams:get_upstream_by_hash(hkey)
- local addr = upstream:get_addr()
-
- asn_score,total_asn = new_score_set(score, asn_score, total_asn)
- country_score,total_country = new_score_set(score, country_score, total_country)
- ipnet_score,total_ipnet = new_score_set(score, ipnet_score, total_ipnet)
- ip_score,total_ip = new_score_set(score, ip_score, total_ip)
-
- rspamd_redis.make_request(task, addr, score_set_cb,
- 'HMSET', {options['hash'],
- options['asn_prefix'] .. asn, string.format('%f|%d', asn_score, total_asn),
- options['country_prefix'] .. country, string.format('%f|%d', country_score, total_country),
- options['ipnet_prefix'] .. ipnet, string.format('%f|%d', ipnet_score, total_ipnet),
- ip:to_string(), string.format('%f|%d', ip_score, total_ip)})
- end
+ local hkey = ip_score_hash_key(asn, country, ipnet, ip)
+ local upstream = upstreams:get_upstream_by_hash(hkey)
+ local addr = upstream:get_addr()
+
+ asn_score,total_asn = new_score_set(score, asn_score, total_asn)
+ country_score,total_country = new_score_set(score, country_score, total_country)
+ ipnet_score,total_ipnet = new_score_set(score, ipnet_score, total_ipnet)
+ ip_score,total_ip = new_score_set(score, ip_score, total_ip)
+
+ rspamd_redis.make_request(task, addr, score_set_cb,
+ 'HMSET', {options['hash'],
+ options['asn_prefix'] .. asn, string.format('%f|%d', asn_score, total_asn),
+ options['country_prefix'] .. country, string.format('%f|%d', country_score, total_country),
+ options['ipnet_prefix'] .. ipnet, string.format('%f|%d', ipnet_score, total_ipnet),
+ ip:to_string(), string.format('%f|%d', ip_score, total_ip)})
end
-- Check score for ip in keystorage