diff options
author | Andrew Lewis <nerf@judo.za.org> | 2015-08-27 00:14:06 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2015-09-02 14:10:00 +0200 |
commit | 03f0bcb32e1006d595c59c5ff823aeae79a8c11a (patch) | |
tree | 9c7052abee483e54afc98b9e8112d5935c9f791a | |
parent | a4fe305046739e4e0a355b5a6e923ebd409acbc6 (diff) | |
download | rspamd-03f0bcb32e1006d595c59c5ff823aeae79a8c11a.tar.gz rspamd-03f0bcb32e1006d595c59c5ff823aeae79a8c11a.zip |
Support IPv6; avoid polluting IPv4 stats on dual stacks
-rw-r--r-- | src/plugins/lua/ip_score.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua index 9072ca16b..f9f768389 100644 --- a/src/plugins/lua/ip_score.lua +++ b/src/plugins/lua/ip_score.lua @@ -39,6 +39,7 @@ local whitelist = nil local options = { asn_provider = 'origin.asn.cymru.com', -- provider for ASN data + asn6_provider = 'origin6.asn.cymru.com', -- provider for ASN data actions = { -- how each action is treated in scoring ['reject'] = 1.0, ['add header'] = 0.25, @@ -83,8 +84,12 @@ local function asn_check(task) end if ip and ip:is_valid() then + local asn_provider = 'asn_provider' + if ip:get_version() == 6 then + asn_provider = 'asn6_provider' + end local req_name = rspamd_logger.slog("%1.%2", - table.concat(ip:inversed_str_octets(), '.'), options['asn_provider']) + table.concat(ip:inversed_str_octets(), '.'), options[asn_provider]) task:get_resolver():resolve_txt(task:get_session(), task:get_mempool(), req_name, asn_dns_cb) |