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?
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).