Performing dns lookups inside python module?

Hi,

I would like to use the python module to do some processing of queries.
But the trick is, I will need to do some lookups before releasing the
query I'm processing. Is that possible at all?

The examples listed on the unbound.net site don't seem to do this kind
of trickery...

Paul

You need multiple threads in unbound to do the extra lookups: the
original lookup that triggered your python module occupies thread0 until
you return a result.

A pristine config (with threads=1) will create a deadlock when you do a
dns lookup from the module. Ran into this last year :slight_smile:

There is also the dnspython module.

The issue is I am capturing unbound queries, hack some work, then
let them pass through. I'm modifying the resolver behaviour.

Paul

Hi,

There is also the dnspython module.

The issue is I am capturing unbound queries, hack some work, then
let them pass through. I'm modifying the resolver behaviour.

It should technically be possible to do two kinds of lookups: direct
dns queries to a server IP address, and you can spawn recursion, a
query that receives full validation and resolution from unbound.
These simply involve calling some function callback from the module
environment and then exit from processing this event. When the lookup
is done the python module is triggered again with an event. Because
you exited the processing of this event, unbound should not block or
deadlock.

Best regards,
   Wouter