nmh-workers
[Top] [All Lists]

[Nmh-workers] annoying DNS lookups

2011-05-12 09:13:15
Hi!

I observe that on one of my machines (IPv6 only system) every time I
run scan/show/repl (and probably others) a DNS query for the A record
of the machines hostname is sent. If a NXDOMAIN comes back everything is
fine, but if the request is lost then the command hangs for a few seconds.

This might be a bug in nmh, the gnu libc, both or neither. I'd like your
opinion on this.

I think this is caused by the following lines in sbr/mts.c

        /* now fully qualify our name */

        memset(&hints, 0, sizeof(hints));
        hints.ai_flags = AI_CANONNAME;
        hints.ai_family = PF_UNSPEC;
        if (getaddrinfo(buffer, NULL, &hints, &res) == 0) {
            strncpy(buffer, res->ai_canonname, sizeof(buffer) - 1);
            freeaddrinfo(res);
        }

It seems that getaddrinfo tries to lookup the IPv4 address of the
hostname and then do a reverse lookup to get the FQDN but doesn't 
find it in /etc/hosts (because the system is v6 only) and thus
goes on asking the DNS.

I think this is a bug in the libc, because it should use the IPv6
entry in my /etc/hosts.

I think this might also be a bug in nmh, because I don't see why 
show would need to now the FQDN of the maschine it is running
on. I expect it to show a message the same no matter from which
computer I'm using it. Also this logic to determine the FQDN might
be a bad default nowadays as most computers have addresses from
private ip ranges via DHCP and garbage in their /etc/hosts.
But I have to admit: I never noticed any problems before.

For now the workaround is quite easy: Just define localname in
mts.conf ...

Harald

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>