[Exim] DNS lookups failing

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Chris Hughes
Fecha:  
A: exim-users
Asunto: [Exim] DNS lookups failing
I have a very simple exim configuration which I want to use to relay
_all_ email to a central relay, and have the complex routing handled from
there. So I defined a router:

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.

Stop me now if this is the obviously wrong way to do this...

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.

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.

The reason it works on Solaris but not Linux is :

From 'exim -bt <add>' on Solaris:
[...]
finding IP address for smtprelayhost
doing DNS lookup
DNS lookup of relay (A) gave HOST_NOT_FOUND
returning DNS_NOMATCH
DNS lookup failed: trying getipnodebyname
fully qualified name = smtprelayhost.full.domain.name
gethostbyname looked up these IP addresses:
[...] -> Success!

From 'exim -bt <add>' on Linux:
[...]
finding IP address for smtprelayhost
doing DNS lookup
DNS lookup of relay (A) gave HOST_NOT_FOUND
returning DNS_NOMATCH
DNS lookup failed: trying getipnodebyname    [*]
gethostbyname returned 1 (HOST_NOT_FOUND)
no IP address found for host smtprelayhost
[...] -> Failed!


Actually, this line isn't quite correct, as getipnodebyname() isn't
actually being called - its actually calling host_find_byname() in host.c,
which ends up being a call to gethostbyname() on both Linux and Solaris
(sans-ipv6).

A short program to demonstrate:

main() {
struct hostent *he;

_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);
he = gethostbyname("smtprelayhost");
[...]
}

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

Remove the _res.options line and both Solaris and Linux resolve.

Any pointers?

ta,

Chris