site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AcoazllPocDftQ4OTxOzTzP6XW+EdwBat/0w Thread-topic: dns_lookup returns NULL? Thanks for all the responses. It turns out the problem was pilot error with resolv.conf having a non-symmetrical DNS server listed. mDNSResponder had switched to the second DNS server in the list, which was a valid DNS server, it just couldn't answer the questions we were asking it. This is such a common misunderstanding among sysadmins, that we even ship a test utility that insures all the servers listed in resolv.conf are replicas. Of course, the person running the utility has to believe the warning... :) mp -----Original Message----- From: darwin-dev-bounces+mike.patnode=centrify.com@lists.apple.com [mailto:darwin-dev-bounces+mike.patnode=centrify.com@lists.apple.com] On Behalf Of Josh Graessley Sent: Tuesday, August 11, 2009 2:55 PM To: Paul Kwan Cc: darwin-dev@lists.apple.com; appledev Subject: Re: dns_lookup returns NULL? There are a few more steps you can take to try and narrow down the cause of the problem. dns-sd talks directly to mDNSResponder so you can check to see if that is working: dns-sd -G v4 www.google.com If that's failing, there may be clues in mDNSResponders state. You can dump that state using: sudo killall -INFO mDNSResponder That will dump the state to the system log. Potentially useful is: scutil --dns That will dump the global DNS settings. mDNSResponder should be using those DNS settings. -josh On Aug 11, 2009, at 2:46 PM, Paul Kwan wrote:
In our test environment where it happens, there are no configd core dumps in /cores folder or crash reports in /Library/Logs/CrashReporter and /Library/Logs/DiagnosticReports folders.
PSK
On 8/11/09 2:37 PM, "Josh Graessley" <jgraessley@apple.com> wrote:
I believe the most common cause of this failure is a configd crash (usually in one of the plug-ins). If configd crashes, other parts of the system are unaware that they will no longer receive notification of network changes. mDNSResponder loses DNS settings.
-josh
On Aug 11, 2009, at 2:32 PM, Marc Majka wrote:
On 10.6, DNS queries are sent to mDNSResponder rather than to DirectoryService as they were on 10.5. If you can reproduce the problem, you may be able to collect some useful debugging output from mDNSResponder. See the mDNSResponder man page for info on getting debug log info. If you can get some data, please file a bug report.
You are correct: dig, nslookup, and host all use bare-bones network routines from BIND. The follow a very different code path than mDNSResponder.
-- Marc
On 11 Aug, 2009, at 14:17, Mike Patnode wrote:
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 <majka@apple.com> Subject: Re: dns_lookup returns NULL? To: appledev <appledev@centrify.com> Cc: darwin-dev@lists.apple.com Message-ID: <EB755AEA-2B4B-4D95-B453-4E538C1E6EC2@apple.com> 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/majka %40apple.com
This email sent to majka@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/majka%40apple.com
This email sent to majka@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/jgraessley%40apple.com
This email sent to jgraessley@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/mike.patnode%40centrif y.com This email sent to mike.patnode@centrify.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com