Subject: resolv.conf domain v. search

resolv.conf domain v. search

From: Erik Kline <ek_at_google.com>
Date: Thu, 12 Mar 2009 02:20:17 -0700

All,

I was observed that applications using c-ares parsing /etc/resolv.conf
with both a domain directive and a search directive were behaving
differently from other resolver libraries. It was tracked down be the
order of the directives. On an Ubuntu-based system, "man resolv.conf"
contains the following text:

"""
The domain and search keywords are mutually exclusive. If more than
one instance of these keywords is present, the last instance wins.
"""

However, looking at ares_init.c in init_by_resolv_conf(), lines 819
and 823 show that whichever line is encountered first wins. I believe
the change to bring the behaviour closer to parity would be to simply
delete the "&& channel->ndomains == -1" check. I verified that
set_search() frees any domains already set and config_domain() proxies
through to set_search() and believe this change would be safe.

But I'm not sure what the ramifications of this change would be to
other systems' behaviour, nor am I sure what the "standard" for this
is/should be, nor who sets such a standard. So I figured I'd ask the
all-knowing c-ares developers (who may also be all-singing and
all-dancing, I'm not sure).

Thanks,
-Erik
Received on 2009-03-12