Subject: Re: accepting both ipv4 and v6 connections
To: None <tech-net@NetBSD.org>
From: Jeff Rizzo <riz@boogers.sf.ca.us>
List: tech-net
Date: 05/12/2004 11:09:34
On Wed, May 12, 2004 at 12:56:33PM -0400, der Mouse wrote:
> >> getaddrinfo()'s interface contract makes no promises about what
> >> order the returned list is in.
> > Yes, I figured as much.  Seems like the (or at least _a_) more
> > correct thing to do is to loop over all the AI_PASSIVE addresses
> > returned and open a listening socket for each.
> 
> That phrasing indicates a belief that the ai_flags field of the
> returned structures is useful.  This is not so.  The NetBSD manpage
> does not mention it, but RFC3493 explicitly says "The contents of the
> ai_flags field of the returned structures are undefined.", which,
> grammar mistake aside, seems to me pretty clear.

Yes, I didn't intend to state that I was checking the return value
of ai_flags, rather, setting AI_PASSIVE in the initial call to 
getaddrinfo().  

> > Right now, the code passes around a single "listen_fd", so I'd like
> > to suggest some changes that have the least impact on the code
> > structure, and changing it to pass around an fd_set seems (to my
> > untrained eye, anyway) to be the simplest change to make.
> 
> Probably, but the price it carries for the code is..unpleaseant, at
> least, to me.  (Personally, I usually use a linked list of small
> structs.)

This is valuable feedback.  Thanks - I'll probably do the same.

+j
-- 
Jeff Rizzo                                         http://boogers.sf.ca.us/~riz