Re: bind
Re: bind
- Subject: Re: bind
- From: Marc Majka <email@hidden>
- Date: Fri, 17 Sep 2004 10:56:15 -0700
There are actually two versions of the BIND resolver client library
co-resident on the system. We used to just have a BIND-8 derived
library (Mac OS X 10.2 "Jaguar" and before), and it was found in
libSystem. In 10.3 "Panther", we brought in a BIND-9 resolver client,
but we kept the old BIND-8 version in libSystem for binary
compatibility. The new BIND-9 based library is in
/usr/lib/libresolv.dylib.
Originally, we had intended to leave the BIND-8 library in libSystem
and remove the BIND-8 headers (resolv.h and nameser.h) but we ended up
keeping the old headers and adding the BIND_8_COMPAT switch so that
developers that really, really, had no other choice except to keep
building with the BIND-8 version could do so. If at all possible,
please avoid using BIND-8. It will eventually go away.
We highly encourage developers to use API at the highest level
possible. This will give you the best level of service that we can
provide to your application. It also means that your application will
behave the same way as other high-level applications available to
users. If you limit your application to using very low-level API, then
your users may find that your application has annoying limitations, or
that it will obtain different results than other applications.
If you can, you should take advantage of Core Foundation Networking
APIs. If you are developing code at the "BSD" level, then consider
using API like getaddrinfo(), getnameinfo(), getipnodebyname(),
getipnodebyaddr(), and so on. There are many places where the system
may go to find this information. DNS is one source, but these APIs may
also consult a per-thread ("Level 1") cache, a system-wide ("Level 2")
cache, the /etc/hosts file, as well as directory services like NetInfo
and LDAP-based services.
If you really need to do direct to DNS, then we highly encourage you to
consider using the API in /usr/include/dns.h and dns_util.h. This is a
DNS query-routing API that supports multiple DNS resolver clients. The
API is very similar to the basic BIND search and query APIs, but this
layer routes queries to a "default" resolver (what you would expect to
find in /etc/resolv.conf), as well as to multicast DNS (".local"), and
to private DNS resolvers. We are taking increasing advantage of this
layer for new Apple features in Mac OS X 10.4. Some of them were
described at WWDC. DNS query-routing is becoming increasingly dynamic,
and DNS configuration management is becoming increasingly automatic.
If you really need to use DNS services directly, this is the API to
choose.
Be careful about using the BIND APIs directly. Name resolution on
Darwin / Mac OS has a lot more going on than just calling res_search.
A lot of effort has been made to improve performance through the use of
caching. A lot of extra search functionality has been added to support
Rendezvous, private DNS servers, and DNS over VPN links. Sending your
query to a single resolver might get you the answer you want, but it
will probably be slower and may fail to find answers that applications
using higher-level API will find.
--
Marc Majka
On 17 Sep, 2004, at 07:56, Sam Hart wrote:
On 17 Sep 2004, at 15:46, Matt Watson wrote:
Does adding -lresolv to your link line help?
yes it does, would this be better than -DBIND_8_COMPAT=1 ?
S a m
_______________________________________________
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
References: | |
| >bind (From: Sam Hart <email@hidden>) |
| >Re: bind (From: j o a r <email@hidden>) |
| >Re: bind (From: Sam Hart <email@hidden>) |
| >Re: bind (From: Matt Watson <email@hidden>) |
| >Re: bind (From: Sam Hart <email@hidden>) |