From 03f0bcb32e1006d595c59c5ff823aeae79a8c11a Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Thu, 27 Aug 2015 00:14:06 +0200 Subject: [PATCH] Support IPv6; avoid polluting IPv4 stats on dual stacks --- src/plugins/lua/ip_score.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- 2.39.5