tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: getaddrinfo(3) on numerical addresses
In gmane.os.netbsd.devel.network Joerg Sonnenberger <joerg%bec.de@localhost> wrote:
> On Tue, Oct 24, 2017 at 03:19:29PM +0200, Edgar Fu? wrote:
>> I've noticed[*] that on NetBSD, getaddrinfo(3) does a resolver lookup even
>> if presented a numerical address. Is this on purpose? Would it have a
>> drawback if it would first try to inet_pton() the address?
>> On Linux, it seems to avoid the resolver lookup.
>
> That's what AI_NUMERICHOST is for? It's not clear whether it should or
> should not parse the behavior, see comments in the code.
My guess is that the caller doesn't pass an address that is always
numeric and does't pass the address family hint either - which is the
whole point of the exercise, I gather.
But in that case trying numeric first doesn't help. In fact from a
*very* cursory glance at the sources, it's already trying numeric
first :). The problem, I guess, is that the outer loop, so to say, is
over the address families. So the problem is not that the fqdn lookup
is done before the numeric lookup for the same address family, but
that the fqdn lookup for some other address family is done before.
Again, this is from a very cursory look at the code, so it may be
completely wrong. Caveat emptor.
-uwe
Home |
Main Index |
Thread Index |
Old Index