Custom response for PTR records
Wouter Wijngaards
wouter at nlnetlabs.nl
Fri Oct 25 12:30:14 UTC 2019
Hi Eduard,
On 24/10/2019 20:28, Eduard Ahmatgareev via Unbound-users wrote:
> Hi All,
>
> I found a lot of examples how it possible to make custom response for
> A records in python module, but didn't find any example to make
> reponse for PTR records:
The append statement takes the full range of syntax that you can use in
a zonefile. One line of it. That includes all types of records. Just
like the syntax of the zonefile, in between the quotes.
For a PTR record that could look like this:
if qstate.qinfo.qtype == RR_TYPE_PTR:
msg.answer.append("%s 10 IN PTR www.example.com." %
qstate.qinfo.qname_str)
By the way, also AAAA records can work:
if qstate.qinfo.qtype == RR_TYPE_AAAA:
msg.answer.append("%s 10 IN AAAA 2001:db8::1" % qstate.qinfo.qname_str)
Best regards, Wouter
>
> do you have something like this:
> if qstate.qinfo.qtype == RR_TYPE_A:
> msg.answer.append("%s 10 IN A 192.168.1.1" % qstate.qinfo.qname_str)
> if (qstate.qinfo.qtype == RR_TYPE_SRV) or (qstate.qinfo.qtype ==
> RR_TYPE_ANY):
> msg.answer.append("%s 10 IN SRV 0 0 80 neinfo.example.com
> <http://neinfo.example.com>." % qstate.qinfo.qname_str)
> if (qstate.qinfo.qtype == RR_TYPE_TXT) or (qstate.qinfo.qtype ==
> RR_TYPE_ANY):
> msg.answer.append("%s 10 IN TXT path=/" % qstate.qinfo.qname_str)
>
> but for PTR records?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20191025/44534a8f/attachment.htm>
More information about the Unbound-users
mailing list