Software /
code /
prosody-modules
Comparison
mod_register_dnsbl_firewall_mark/mod_register_dnsbl_firewall_mark.lua @ 3993:76036fa34055
mod_register_dnsbl_*: fix DS legacy ipv4 addresses, thx Zash
author | Georg Lukas <georg@op-co.de> |
---|---|
date | Mon, 27 Apr 2020 17:09:27 +0200 |
parent | 2895:589cc51209f7 |
child | 4011:de40686ae9c8 |
comparison
equal
deleted
inserted
replaced
3992:0233da912ab6 | 3993:76036fa34055 |
---|---|
1 local adns = require "net.adns"; | 1 local adns = require "net.adns"; |
2 local rbl = module:get_option_string("registration_rbl"); | 2 local rbl = module:get_option_string("registration_rbl"); |
3 | 3 |
4 local function reverse(ip, suffix) | 4 local function reverse(ip, suffix) |
5 if ip:sub(1,7):lower() == "::ffff:" then | |
6 ip = ip:sub(8); | |
7 end | |
5 local a,b,c,d = ip:match("^(%d+).(%d+).(%d+).(%d+)$"); | 8 local a,b,c,d = ip:match("^(%d+).(%d+).(%d+).(%d+)$"); |
6 if not a then return end | 9 if not a then return end |
7 return ("%d.%d.%d.%d.%s"):format(d,c,b,a, suffix); | 10 return ("%d.%d.%d.%d.%s"):format(d,c,b,a, suffix); |
8 end | 11 end |
9 | 12 |