[Pdns-dev] lua script to synthesize AAAA record from A record
Peter van Dijk
peter.van.dijk at netherlabs.nl
Fri May 4 12:42:24 CEST 2012
Hello Muntasir,
On May 4, 2012, at 6:47 , Muntasir Rahman wrote:
> function nodata ( remoteip, domain, qtype, records )
> print ("nodata called for: ", remoteip, getlocaladdress(), domain, qtype)
> if qtype ~= pdns.AAAA then return -1, {} end -- only AAAA records
> setvariable()
> return "getFakeAAAARecords", domain, "fe80::21b:77ff:0:0" -- here i need to return ::ffff:ipv4.dotted.decimal.format
> end
>
> I would like to do something like this
>
> ipv4 = "1.2.3.4" -- how do i get this data from recursor ???
> ipv6 = "::ffff:" .. ipv4 -- synthesized representation of IPv4 in IPv6
> return "getFakeAAARecords", domain, ipv6
>
> My question is:
> - how do i get IPv4 data using lua API in above script examples?
You don't. getFakeAAAARecords handles this. Just returning "getFakeAAAARecords", domain, "0:0:0:0:0:ffff:0:0" should work.
(You can't say "::ffff" or "::ffff:" - the first would cause the v4 address to just overwrite those bits and the last would be a parse error).
Kind regards,
--
Peter van Dijk
Netherlabs Computer Consulting BV - http://www.netherlabs.nl/
More information about the Pdns-dev
mailing list