]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Skip extra RBL checks when Received IP same as From IP
authorMike Teplynin <mike@teplynin.com>
Fri, 13 Dec 2024 09:14:01 +0000 (12:14 +0300)
committerMike Teplynin <mike@teplynin.com>
Fri, 13 Dec 2024 09:14:01 +0000 (12:14 +0300)
src/plugins/lua/rbl.lua

index b2ccf86999cd73cb56831aa706a13cad35a33b10..8126e9c8f73a08801603efe7da6ebc4c2b00be4b 100644 (file)
@@ -689,12 +689,17 @@ local function gen_rbl_callback(rule)
 
     local received_total = #received
     local check_conditions = gen_check_rcvd_conditions(rule, received_total)
+    local from_ip = task:get_from_ip()
 
     for pos, rh in ipairs(received) do
       if check_conditions(rh, pos) then
-        add_dns_request(task, rh.real_ip, false, true,
-            requests_table, 'received',
-            whitelist)
+        if rh.real_ip ~= from_ip then
+          add_dns_request(task, rh.real_ip, false, true,
+              requests_table, 'received',
+              whitelist)
+        else
+          lua_util.debugm(N, task, 'Received IP same as From IP, skipping extra check')
+        end
       end
     end