[Pdns-users] Lua view record - how to return NXDOMAIN?

Otto Moerbeek otto at drijf.net
Wed Oct 30 07:30:24 UTC 2024


On Tue, Oct 29, 2024 at 10:14:29PM +0000, Djerk Geurts via Pdns-users wrote:

> Hi all,
> 
> Is there a way to return NXDOMAIn instead of a valid response?
> 
> test IN LUA CNAME "view({{{'10.0.0.0/16'},{‘ns0.internal.domain.com.'}},{{'0.0.0.0/0'},{''}}})”
> 
> I would like to return NXDOMAIN instead of SERVFAIL for sources outside 10.0/16.
> 
> Thanks,
> Djerk Geurts

I don't think NXDOMAIN responses are possible from Lua records.

I guess a NODATA (rcode NOERROR + empty answer section) is the closest you
can come.

views do not like empty response sets, but this worked for me to get a
a NODATA:

test.example     10      IN      LUA     A "; if (0==1) then return {'1.2.3.4'} else return {} end"

Maybe you can work from this.

	-Otto



More information about the Pdns-users mailing list