dns_ioevent() not called when DNS server is not recursive

Iñaki Baz Castillo ibc at aliax.net
Fri Feb 4 04:08:34 MSK 2011


Hi, I'm testing udns in async mode with poll(). I know that udns is a
stub resolver, so I'm not reporting a bug, but just want to be
clarified.

In my test I set a non recursive DNS server in /etc/resolv.conf, then
I do an async DNS query. poll() returns true so something has arrived
via UDP, but dns_ioevent() doesnt' call the callback routine. In fact,
if I test the same using "getdns" I get an error "temporary failure in
name resolution".

So I assume that, indeed, an UDP DNS response has been replied by the
server, but it contains a DNS error (maybe it says that the server is
non recursive so cannot perform the query as the client has
requested). Then when I call dns_ioevent() the callback is not
executed.

But after dns_ioevent() I check dns_status() and it returns 0, so no
error. I don't understand why. Is it the expected behaviour? if so,
how can I realize of the error?


Basically this is the important part of my testing code:

-------------------------------------------
  dns_submit_srv(NULL, domain, service, protocol, 0, dns_cb, NULL)

  now = time(NULL);

  while (! NULL) {
    t = dns_timeouts(0, -1, now);
    t = poll(&pfd, 1, 100);
    now = time(NULL);
    if (t) {
      dns_ioevent(NULL, now);
      printf("--- dns_status = %i\n", dns_status(NULL));
      break;
    }
  }
------------------------------------------



Also I would like to confirm other point, now using a recursive DNS server:

If I query for a non existing domain, the callback routine is
executed, but rr argument is passed as NULL (and of course
dns_status() returns -3 = DNS_R_NXDOMAIN).

So why in this case (the domain doesn't exist) the callback routine is
executed will null rr? why in the first case the routine is not called
neither dns_status() returns an error?.


Thanks for any help. Best regards.


-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the udns mailing list