[Unbound-users] Responses from pythonmodule back into iterator?

W.C.A. Wijngaards wouter at NLnetLabs.nl
Tue Aug 16 10:30:42 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jan-Piet,

On 08/10/2011 08:18 PM, Jan-Piet Mens wrote:
> Hello,
> 
> I'm playing with the Python module in Unbound 1.4.12 and have replaced
> the RR in example2 [1] to read
> 
>         msg.answer.append("%s 10 IN CNAME google.com" % qstate.qinfo.qname_str)
> 
> Unbound replies to a query thusly:
> 
>         dig @127.0.0.1 foo.localdomain any
>         ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
> 
>         ;; ANSWER SECTION:
>         foo.localdomain.        10      IN      CNAME   google.com.
> 
> What must I do to instruct the module it should pass that response back
> into the iterator to resolve `google.com' to its A RR(set)? Or am I
> barking up the wrong tree?

The current query is for foo.localdomain, you have to spawn a
recursively subquery that does the google.com name.  This is what the
resolver does for its recursion abilities.  It should be possible from
python, although I am not sure if the interface is exposed; it is the
mesh_attach_sub routine.  After called the current context is suspended
and wakes up again when the sub query has finished (or encountered errors).

Another way to handle is as a CNAME.  The iterator can follow CNAMEs,
you have to set the necessary qchase and stored RRs from the CNAME
correctly in the mesh_qstate for the iterator and activate the iterator
again (just as if the iterator had seen this CNAME itself).

Best regards,
   Wouter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOSkbSAAoJEJ9vHC1+BF+Np0AP/0RUVaFMxeaMLT7U2qxZBNsA
jjU64hxiXkCbC1prTLGydikYht5BqGJs0jxUKg+anlo0Ne5rvBsmW/IFSCCsoAVe
KlIzrPvZTJerNCzdxJSrjvBAWJyU8VLpHWUhNE5FhVN6WbKbVWw19v3BiyLHpU1y
0kYJkpnM2qIQ0/JHM3xyrAEX31565QKYjwrDAM+cZMA5F2V+Nes+UVMs3WIpWpTs
e6Ki1+vIIgZtJib3XEd7pyeDBb283pYRUFH+LI8s+SQgUWVvBxYPQvxqtlSLxuJY
weTLDtiSP4QMh5v/IJpxKMk3CNGUl2LRqC3A3VNUcQBYzj+4eUS+M5erGWbp8bhZ
rYhjw2tLFG0RUhorvhsLx2HG3H2u1nL/SCZj3tV8+ar7POkX/OgZ8wA8ToS/yFVT
m8Yxz8tzUzn+IeHKy8ud7heaJBRzAHNJjhcNw7hsdbzByCUc4tKf9lKfO0EJAP8w
hSfWmagLbzW/rmW511gvoeUzjhV1QVwughxsLG4ggCgeikHmSOfeRJBnUJi+Np6G
9i4ObjjJHnErHeULJrxG52kkNQJ4IFc0inTJYad1tXPQ1mxb6WS/BmkCDyYOXNkB
3Bmhnprg3VAcxjniVwAuq25tvL0OeJW3MHTThyEdLALiGXcGOknMN7ZYrIYo9zln
3sANIauLS51wMBAKJS3x
=fHtS
-----END PGP SIGNATURE-----



More information about the Unbound-users mailing list