Re: [Exim] DNS lookups failing

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Chris Hughes
CC: exim-users
Tárgy: Re: [Exim] DNS lookups failing
On Wed, 10 Sep 2003, Chris Hughes wrote:

> route_to_relay:
> driver = manualroute
> host_find_failed = defer
> route_list = * smtprelayhost
> transport = remote_smtp
>
> And a transport:
>
> remote_smtp:
> driver = smtp
>
> I use smtprelayhost rather than smtprelayhost.domain.name so that I can
> use the same config file in each location and it should resolve the local
> relay host.


Non-fully qualified names are dangerous if used in DNS lookups, because
you can never be sure how the resolver is going to treat them.

One way round this is to ensure that the name is in /etc/hosts, and use

route_list = * smtprelayhost byname

> The above works fine on Solaris, but I use the same configuration file
> on Linux (Redhat, 2.4.9 kernel) (both with exim 4.22) and the lookup of
> the relay host fails.


I suspect this is a difference in the DNS resolver behaviour.

> The basic DNS lookup fails to find the hostname due to the default
> res_options defined in dns.c
>
> 48: _res.options &= ~(RES_DNSRCH | RES_DEFNAMES);
>
> I'm sure there's a valid reason for this, but how do I get around it just
> for the manualroute router? Neither qualify_single nor search_parents are
> valid options for that router.


You didn't quote the full code extract, which reads:

_res.options &= ~(RES_DNSRCH | RES_DEFNAMES);
_res.options |= (qualify_single? RES_DEFNAMES : 0) |
                (search_parents? RES_DNSRCH : 0);


In other words, those options are controlled by Exim option settings.
However, you are right, those options are available only for the
dnslookup router.

> This resolves ok on Solaris (ie. gethostbyname() doesn't use
> _res.options), but fails on Linux (ie. gethostbyname() uses _res.options).


That just proves my point about resolvers behaving differently!

> Any pointers?


I think your best bet for something that you know will work is to set it
up so that the DNS is not involved.

Or, if you must use the DNS, find a way of detecting the .domain.name so
that you can use a fully-qualified name. For example, if the
.domain.name is always the same as that of $primary_hostname, you could
use some string expansion manipulation to extract it.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book