Subject: Re: resolv.conf domain v. search

Re: resolv.conf domain v. search

From: Erik Kline <ek_at_google.com>
Date: Sat, 15 Aug 2009 00:16:07 -0700

2009/3/17 Daniel Stenberg <daniel_at_haxx.se>:
> On Thu, 12 Mar 2009, Erik Kline wrote:
>
>> However, looking at ares_init.c in init_by_resolv_conf(), lines 819 and
>> 823 show that whichever line is encountered first wins.
>
> I'd say that sounds wrong then comparing with the docs you quoted.
>
>> 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.
>
> We should also add something to our docs about the importance of order and
> how it is used when both are found.
>
>> 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.
>
> In general I think we need to mimic how other resolvers work as far as
> possible to get happy users of our softwares, so I think you're clearly on
> the right path here.
>
> Can you write up a proper patch and submit it here?
>
> --
>
>  / daniel.haxx.se
>

So I've found online references to resolv.conf man pages for OpenBSD
and Solaris and they both have the exact same sentence about the
priority of repeated search and domain directives. Given the number
of times that text has been repeated verbatim in variously licensed
operating system one might assume copyright is not problem. :-)
Nonetheless, I'm not sure where I should add such text. Let me know
where I should add it, if you want me to take a stab at something.

Attached is trivial patch that implements the behaviour change though.

Received on 2009-08-15