(E-Mail Removed) (Bill Unruh) wrote in message news:<ck9fvk$95m$(E-Mail Removed)>...
> oThe new getaddrinfo routines (which are IPV6 ready instead of the
> gethostbyaddr etc routines) seem to query the internet even if they find
> the name in /etc/hosts. I have no idea why. I found this with ssh. Mandrake
> could not replicate the problem, and I have ot pushed it, so I pass the
> torch to you.
> Does exim use getaddrinfo rather than gethostbyname or gethostbyaddr? If
> not my comments are irrelevant. If it does, use strace to narrow it down.
Thanks for pointing me to strace. What a fascinating program!
I put strace with appropriate args to start exim in inetd.conf,
capturing a log file, and did the test again. From the log file, exim
does the following:
Opens and reads /etc/exim.conf
Opens, reads, then closes /etc/resolv.conf
Opens, reads, then closes /etc/nsswitch.conf
Opens, reads, then closes /etc/host.conf, and the contents "order
hosts,bind\nmulti on\n" appears in the logfile!
opens, reads, then closes /etc/hosts
opens a socket and connects to the ISP's nameserver!!
So, it's reading all the right files, that tell it to use /etc/hosts,
and it's reading /etc/hosts. But then it's ignoring the contents and
connecting to the nameserver anyway.
The exact content of the logfile, from the point where it reads
exim.conf up to the point where it connects to the nameserver, follows
in case you or anyone can see anything useful I overlooked.
----cut here-----
open("/etc/exim/exim.conf", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=430, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=430, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x40018000
read(3, "#Main (global) configuration set"..., 4096) = 430
uname({sys="Linux", node="Leo", ...}) = 0
gettimeofday({1097402473, 24045}, NULL) = 0
getpid() = 13327
open("/etc/resolv.conf", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=63, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x40019000
read(4, "search galaxy\nnameserver 213.160"..., 4096) = 63
read(4, "", 4096) = 0
close(4) = 0
munmap(0x40019000, 4096) = 0
socket(PF_UNIX, SOCK_STREAM, 0) = 4
connect(4, {sa_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) =
-1 ENOENT (No such file or directory)
close(4) = 0
open("/etc/nsswitch.conf", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=465, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x40019000
read(4, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 465
read(4, "", 4096) = 0
close(4) = 0
munmap(0x40019000, 4096) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=45416, ...}) = 0
old_mmap(NULL, 45416, PROT_READ, MAP_PRIVATE, 4, 0) = 0x402ff000
close(4) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
directory)
open("/lib/tls/libnss_files.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\ 33\0\000"...,
512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=35140, ...}) = 0
old_mmap(NULL, 38520, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) =
0x4030b000
old_mmap(0x40314000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 4, 0x8000) = 0x40314000
close(4) = 0
munmap(0x402ff000, 45416) = 0
open("/etc/host.conf", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=26, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x402ff000
read(4, "order hosts,bind\nmulti on\n", 4096) = 26
read(4, "", 4096) = 0
close(4) = 0
munmap(0x402ff000, 4096) = 0
open("/etc/hosts", O_RDONLY) = 4
fcntl64(4, F_GETFD) = 0
fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=517, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x402ff000
read(4, "127.0.0.1\tlocalhost\n192.168.1.9\t"..., 4096) = 517
read(4, "", 4096) = 0
close(4) = 0
munmap(0x402ff000, 4096) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=45416, ...}) = 0
old_mmap(NULL, 45416, PROT_READ, MAP_PRIVATE, 4, 0) = 0x402ff000
close(4) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or
directory)
open("/lib/tls/libnss_dns.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2 60\r\0"...,
512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=13424, ...}) = 0
old_mmap(NULL, 16328, PROT_READ|PROT_EXEC, MAP_PRIVATE, 4, 0) =
0x40315000
old_mmap(0x40318000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 4, 0x2000) = 0x40318000
close(4) = 0
munmap(0x402ff000, 45416) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("213.160.40.2")}, 28) = 0
send(4, "a\214\1\0\0\1\0\0\0\0\0\0\3Leo\6galaxy\0\0\34\0\1 ", 28, 0) =
28
gettimeofday({1097402473, 26934}, NULL) = 0
--cut here-----
Note: 213.160.40.2 is one of the ISP's nameservers.