Re: Making Squid 3.1 respect more than one search domain when parsing resolv.conf

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 10 Dec 2009 16:55:48 +1300

James Brotchie wrote:
> Hi,
>
> Currently (as of 3.1.0.14) Squid's inbuilt resolver only respects the
> last domain or search directive in /etc/resolv.conf.
>
> Before each search or domain directive is processed idnsFreeSearchpath
> (in dns_internal.cc) is called, clearing any existing search paths.
> The desired behaviour in our scenario is to append all domain and
> search directives to the list of resolver search paths.
>
> Removing the idnsFreeSearchpath calls at dns_internal.cc:321,331 makes
> squid behave as desired.
>
> Does anyone know the rationale behind throwing away the search path
> prior to processing each resolv.conf directive? Is this simply a
> bug/oversight? Should a configuration option be added at compile time
> or in squid.conf to adjust this behaviour?

 From the specs:

"
the desired domain search path following the search keyword with spaces
or tabs separating the names
"
...
"
The domain and search keywords are mutually exclusive. If more than one
instance of these keywords is present, the last instance wins.
"

>
> EXAMPLE
> =======
> --- start /etc/resolv.conf ---
>
> search nb
> search test.com
> search extra.domain.net
> nameserver 127.0.0.1
>
> --- end /etc/resolv.conf ---
>

Entering your example config into my /etc/resolv.conf and then pulling
the resolver config out of the OS I get:

## nslookup
## > set all
Default server: 127.0.0.1
Address: 127.0.0.1#53

Set options:
   novc nodebug nod2
   search recurse
   timeout = 0 retry = 3 port = 53
   querytype = A class = IN
   srchlist = extra.domain.net

Here is a working multiple-domain resolv.conf based on your intended
search list:

--- start /etc/resolv.conf ---

  search nb test.com extra.domain.net
  nameserver 127.0.0.1

--- end /etc/resolv.conf ---

The OS resolver reports:

## nslookup
## > set all
Default server: 127.0.0.1
Address: 127.0.0.1#53

Set options:
   novc nodebug nod2
   search recurse
   timeout = 0 retry = 3 port = 53
   querytype = A class = IN
   srchlist = nb/test.com/extra.domain.net

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE7 or 3.0.STABLE20
   Current Beta Squid 3.1.0.15
Received on Thu Dec 10 2009 - 03:55:58 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 10 2009 - 12:00:02 MST