[Pdns-users] LUA SRV records

Otto Moerbeek otto at drijf.net
Tue May 30 11:18:21 UTC 2023


On Tue, May 30, 2023 at 11:33:32AM +0200, Kai Stian Olstad via Pdns-users wrote:

> On 29.05.2023 15:44, George Asenov via Pdns-users wrote:
> > Hello community,
> > 
> > I already searched the documentation but couldn't find an answer to my
> > questions.
> > 
> > Is it possible to add LUA SRV record which will return different
> > weight based on query source IP address?
> > 
> > Are LUA SRV records supported at all?
> 
> <snip />
> 
> > _k8splanes._tcp.example1.com    30      IN      LUA     SRV "view({ {
> > {'55.55.55.55/26'}, {'1 6444 k8s-plane1.example1.com'}},{
> > {'66.66.66.66/24'}, {'5 6444 k8s-plane1.example1.com'}}})"
> > 
> > A record works as it should but SRV don't.
> 
> The documentation[1] say this for view:
> "This function also works for CNAME or TXT records."
> And it have an example for A record, so I guess that answer your question.
> 
> 
> [1] https://doc.powerdns.com/authoritative/lua-records/functions.html#view

If you look at the logs you'll see the SRV record content is not correct.

It works if you supply correctly formed SRV records (in presentation format).
In particular, a SRV record has three numbers and then a name.

I just tried 

srv.example.net 10      IN      LUA     SRV "view({{{'127.0.0.1'},{'10 20 999 k8s-plane1.example1.com.'}},{{'0.0.0.0/0'}, {'10 20 999 k8s-plane1.DEFAULT.'}}})"

And it worked as expected.


	-Otto



More information about the Pdns-users mailing list