Subject: Re: getaddrinfo search order
To: Frank van der Linden <frank@wins.uva.nl>
From: None <itojun@iijlab.net>
List: tech-net
Date: 02/11/2000 00:58:18
>The problem is, that getaddrinfo roughly does something like this,
>when called with PF_UNSPEC:
> for each address family
> call gethostbyname2()
> return if it succeeed.
>Since it has PF_INET6 before PF_INET, this made it want to go to the
>DNS server, since it did not find an INET6 match in /etc/hosts.
>What I think it should be doing is:
> for each "hosts:" option in nsswitch.conf
> for each address family
> call gethostbyname2()
> return if it succeeded
>..so that it does "files" first for all address families, then "dns", etc.
>I realize that this will mean rearranging the code.
>Am I wrong in expecting this behaviour?
I understand the problem. To do this, we need to implement
another nsdispatch() variant, and call that from getaddrinfo().
As *BSD uses different version of BIND resolver, I don't think
KAME team can maintain that code...
(nsdispatch() is only in netbsd, IIRC)
If we do the above, I would like to make it possible to put
extended IPv6 scoped address notation (de0%fe80::1) into /etc/hosts.
This requires that resolver use sockaddr as basic type, not in{,6}_addr.
itojun