[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] annoying DNS lookups
From: |
Ken Hornstein |
Subject: |
Re: [Nmh-workers] annoying DNS lookups |
Date: |
Thu, 12 May 2011 10:48:30 -0400 |
>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
Hm, I see it now. That code was done by me, but I was just converting over
the old code which used gethostbyname().
>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.
So, it's more subtle than that.
It's not asking for the IPv4 address (because we're using PF_UNSPEC);
it's really just trying to get a canonical name for the local host. In
this case it should NOT be done by geting the reverse address; you get
the canonical name as part of the forward query.
>I think this is a bug in the libc, because it should use the IPv6
>entry in my /etc/hosts.
Well, I think what's messing things up here is the use of AI_CANONNAME.
As for why it's not considering what it's /etc/hosts canonical ... I guess
you'd need to check your libc to see exactly what getaddrinfo is doing.
>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.
So, it's doing that to try to get the fully qualified local name.
That's used primarily in address parsing (but it's used in a few places
where I don't know all of the subtlies). Hm, I'm not sure of the right
thing to do here. Anyone else have ideas?
Maybe we should be using AI_ADDRCONFIG? Hey, could you try adding that
to hints.ai_flags and see if that solves your problem?
--Ken
- [Nmh-workers] annoying DNS lookups, Harald Geyer, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups,
Ken Hornstein <=
- Re: [Nmh-workers] annoying DNS lookups, Lyndon Nerenberg, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups, Ken Hornstein, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups, Lyndon Nerenberg, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups, Ken Hornstein, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups, Valdis . Kletnieks, 2011/05/12
- Re: [Nmh-workers] annoying DNS lookups, Ken Hornstein, 2011/05/12