Re: dns_lookup returns NULL?
Re: dns_lookup returns NULL?
- Subject: Re: dns_lookup returns NULL?
- From: "Mike Patnode" <email@hidden>
- Date: Tue, 11 Aug 2009 14:17:08 -0700
- Thread-topic: Re: dns_lookup returns NULL?
I'll buy that. Any idea why on 10.6 it would suddenly start returning
NULL for all lookups and continue to do so until a reboot? Tried
restarting DS as well to no avail but a reboot seems to solve the
problem once the system gets in that state. Where should I start
looking for debug info?
Note that dig and nslookup work fine, but I suspect they don't use this
API.
mp
Date: Mon, 10 Aug 2009 15:25:55 -0700
From: Marc Majka <email@hidden>
Subject: Re: dns_lookup returns NULL?
To: appledev <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"
The "status" field of the dns_reply_t structure is currently unused
(it's always zero). There's really not a lot of useful error
information that could be returned by this level of API. dns_lookup()
may do multiple queries to multiple DNS clients (see the resolver(5) man
page). If none of the resolvers returned useful data for the query,
dns_lookup() returns NULL. A failure like NXDomain from a particular
nameserver really doesn't mean much if dns_lookup() is searching
multiple sources.
The situation is similar to an API like, say, getpwnam(). The
DirectoryService daemon might search many different information sources
to answer a getpwnam() query. If it finds data, it returns it. It
really doesn't mean a lot if, as part of it's search, it got an error
from an LDAP or NIS server, or if it checked /etc/passwd and failed to
find a particular user. A reply is really a composite of all of the
sub-searchs performed to answer a query. A NULL reply means they all
"failed" in some way, but the API abstracts away the return codes for
the various sub-systems.
--
Marc Majka
On 10 Aug, 2009, at 14:37, Mike Patnode wrote:
> Is there anyway to get error information when dns_lookup() returns
> NULL? It looks like the error code is supposed to be returned in
> the dns_reply_t structure. What does it mean when the return value
> is NULL?
>
> thx
> mp
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden