Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Using apple resolver libraries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using apple resolver libraries



On 9 May, 2004, at 23:10, Andrew White wrote:

> Apple uses a special resolver / DNS client selection routine, as
> specified by resolver(5). Can someone point me at:
>
> (1) Source code. I have libinfo, but it's rather opaque to cursory
> examination.

The source for Apple's multi-client DNS API is in:

http://cvs.opendarwin.org/index.cgi/src/netinfo/resolver/dns.c
http://cvs.opendarwin.org/index.cgi/src/netinfo/resolver/dns.h

and related files in netinfo/resolver (chiefly dns_private.h and
dns_uitl.[ch]).


> (2) Documentation on how it works "inside".

dns.h, dns_util.h and man resolver(5) describe the public API.

The multi-client DNS search API is built on top of a mostly BIND-9
resolver. All those sources are in the netinfo/resolver directory.
The dns_search(), dns_query(), and dns_lookup() (see dns_util.c) use a
fairly small subset of the BIND resolver - basically just res_search()
and res_query(). The main change you'll see in the BIND sources is
__res_vinit_from_file() in res_init.c. This is pretty much the same as
the BIND's __res_vinit(), but allows one to initialize a resolver from
a path other than just /etc/resolv.conf.

The "inside" of this layer manages two things:

- a cache of resolver clients (mostly in the _check_cache() routine).
- a matching algorithm that selects DNS clients for a given query name
(in the _pdns_get_handles_for_name() routine)

Note that most of the routines in the source files are not public API,
and are very likely to change in future releases of Mac OS X.

> (3) Diffs from FreeBSD, or wherever the original base code came from.

The multi-client DNS search / query routing API was created at Apple.
It became public API In Mac OS 10.3. It is a layer of software that
sits above the traditional resolver API (currently based on BIND-9
sources). Some changes were made in the BIND-9 sources when they were
ported to Mac OS X, but the BIND-9 API described in <resolv.h> and
<arpa/nameser.h> is unchanged.

I should draw attention to the comment in the dns.h header file and the
resolver(5) man page, that the resolver configurations may come from
sources other than the /etc/resolv.conf file and the /etc/resolvers
directory. As part of our continuing efforts to make Mac OS X work
well for mobile computing and to make the system even easier to use, we
are moving toward more dynamic DNS configuration management, shifting
the emphasis of DNS configuration to the System Configuration
framework, and away from the file system.

--
Marc Majka
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Using apple resolver libraries (From: Andrew White <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.