Subject: Re: getaddrinfo() and PF_LOCAL
To: None <itojun@iijlab.net>
From: Assar Westerlund <assar@netbsd.org>
List: tech-net
Date: 08/01/2001 13:55:14
itojun@iijlab.net writes:
> 	don't add it, at least right now.  before adding it, we need to
> 	implement checks likebelow, for all callers that are not compatible
> 	with PF_LOCAL.  it should be added only when we have done this for
> 	all callers (don't know when).
> 		for (res = res0; res; res = res->ai_next) {
> 			/* THE CHECK NEEDS TO BE ADDED */
> 			if (res->ai_family != AF_INET &&
> 			    res->ai_family != AF_INET6)
> 				continue;
> 		}

This is not very much fun.  Then you could as well call getaddrinfo
twice, once with AF_INET and once with AF_INET6, thereby making your
code not address-family independent.

> 	what is the right ordering between AFs?

That's another hard question.  Take the easy case of just getting an
AF_INET and an AF_INET6 address with AI_PASSIVE.  Then, you might have
an IPv4 or IPv6-only node, and you should be able to handle just
getting of the socket families to listen on.  But you should probably
give an error if you don't manage to listen on any of them.  On a
dual-stack node you can get them in any order, and thereby having the
IPv6 socket `shadow' the IPv4 one, requiring you to understand mapped address.
Ugh.

/assar